###@###.### (Robert Uomini)
Solaris only: Calling setMenuBar() then show() twice causes SIGSEGV.
Steps to reproduce
Compile and run the following code
Select File | New
Select Edit | Copy
// note: receive following error:
SIGSEGV 11* segmentation violation
si_signo [11]: SIGSEGV 11* segmentation violation
si_errno [0]: Error 0
si_code [1]: SEGV_ACCERR [addr: 0x1d]
stackbase=EF2BE000, stackpointer=EF2BCD28
Full thread dump:
"Screen Updater" (TID:0xee300b28, sys_thread_t:0xef1bdde8) prio=4
java.lang.Object.wait(Object.java)
sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:76)
sun.awt.ScreenUpdater.run(ScreenUpdater.java:96)
"AWT-Motif" (TID:0xee3009c0, sys_thread_t:0xef2bdde8) prio=5 *current thread*
sun.awt.motif.MFramePeer.toFront(MFramePeer.java:103)
java.awt.Window.toFront(Window.java:120)
java.awt.Window.show(Window.java:98)
ChangeMenu.menuEvent(ChangeMenu.java:42)
AppFrame.action(AppFrame.java:41)
java.awt.Component.handleEvent(Component.java:886)
AppFrame.handleEvent(AppFrame.java:33)
java.awt.Component.postEvent(Component.java:832)
java.awt.MenuComponent.postEvent(MenuComponent.java:94)
java.awt.MenuComponent.postEvent(MenuComponent.java:94)
java.awt.MenuComponent.postEvent(MenuComponent.java:94)
sun.awt.motif.MMenuItemPeer.action(MMenuItemPeer.java:44)
java.lang.Thread.run(Thread.java)
"AWT-Input" (TID:0xee3009a0, sys_thread_t:0xef47dde8) prio=5
"Finalizer thread" (TID:0xee3002e8, sys_thread_t:0xef537de8) prio=1
"Async Garbage Collector" (TID:0xee300298, sys_thread_t:0xef55ade8) prio=1
"Idle thread" (TID:0xee300228, sys_thread_t:0xef57dde8) prio=0
"clock handler" (TID:0xee300070, sys_thread_t:0xef63dde8) prio=11
"main" (TID:0xee300030, sys_thread_t:0x81ad8) prio=5
Monitor Cache Dump:
ChangeMenu@EE300448/EE334558 (key=0xee300448): monitor owner: "AWT-Motif"
unknown key (key=0xef55ade8): unowned
Waiting to be notified:
"Async Garbage Collector"
sun.awt.ScreenUpdater@EE300B28/EE335A40 (key=0xee300b28): unowned
Waiting to be notified:
"Screen Updater"
sun.awt.motif.MToolkit@EE300988/EE335360 (key=0xee300988): monitor owner: "AWT-Motif"
Waiting to be notified:
"AWT-Input"
unknown key (key=0xef2222a0): monitor owner: "main"
Registered Monitor Dump:
Finalize me queue lock: unowned
Waiting to be notified:
"Finalizer thread"
Thread queue lock: unowned
Waiting to be notified:
"main"
Class lock: unowned
Java stack lock: unowned
Code rewrite lock: unowned
Heap lock: unowned
Has finalization queue lock: unowned
Monitor IO lock: unowned
Child death monitor: unowned
Event monitor: unowned
I/O monitor: unowned
Alarm monitor: unowned
Waiting to be notified:
"clock handler"
Sbrk lock: unowned
Monitor cache lock: unowned
Monitor registry: monitor owner: "AWT-Motif"
Thread Alarm Q:
sys_thread_t 0xef55ade8 [Timeout in 452 ms]
Segmentation Fault (core dumped)
****** Source Code here ******
/* Tests changing a menu bar */
import java.awt.*;
class ChangeMenu extends AppFrame
{
private MenuBar fileMenu;
private MenuBar editMenu;
public ChangeMenu(String name)
{
super(name);
// set new MenuBar
fileMenu = new MenuBar();
fileMenu.add(new FileMenu("File"));
setMenuBar(fileMenu);
editMenu = new MenuBar();
editMenu.add( new EditMenu("Edit") );
resize(200, 200);
}
public boolean menuEvent(Event evt, Object obj)
{
String label = (String) obj;
if (label.equals("New") )
{
remove(fileMenu);
setMenuBar(editMenu);
show();
return true;
}
else if (label.equals("Copy") )
{
remove(editMenu);
setMenuBar(fileMenu);
show();
return true;
}
else
return super.menuEvent(evt, obj);
}
public static void main(String args[])
{
ChangeMenu x = new ChangeMenu("Change Menu Test");
x.show();
}
}
/* Generic Full Application Frame
* @(#)AppFrame.java 1.4 15 Nov 1995 15:48:24
* @author Kevin A. Smith
*
* The class AppFrame provides an AWT Frame window for running
* applications.
*
*/
import java.awt.Frame;
import java.awt.Event;
import java.awt.MenuItem;
// Application Frame window
class AppFrame extends Frame
{
// constructor needed to pass window title to class Frame
public AppFrame(String name)
{
// call java.awt.Frame(String) constructor
super(name);
}
// needed to allow window close
public boolean handleEvent(Event e)
{
// Window Destroy event
if (e.id == Event.WINDOW_DESTROY)
return appExit(0);
// it's good form to let the super class look at any
// unhandled events
return super.handleEvent(e);
} // end handleEvent()
// Generic Action event handler
public boolean action(Event evt, Object obj)
{
if(evt.target instanceof MenuItem)
return menuEvent(evt, obj);
else
// it is good form to let the super class look at any
// unhandled events.
return super.action(evt, obj);
} // end action()
// Generic Menu event handler
public boolean menuEvent(Event evt, Object obj)
{
String menuLabel = obj.toString();
if( menuLabel.equals("Exit") )
{
// This menu item is the same as Close
return appExit(0);
}
else
// menu event handler did nothing with this event.
// In a fully written application, you should never
// get to this line.
return false;
} // end menuEvent()
// application exit code
protected boolean appExit(int exitCode)
{
System.exit(exitCode);
return true;
}
} // end class AppFrame
/* Main Menu bar
*
*/
import java.awt.MenuItem;
import java.awt.Menu;
public class FileMenu extends Menu
{
// standard menu item labels
public final String EXIT = "Exit";
public final String NEW = "New";
public final String OPEN = "Open";
public FileMenu(String menuName)
{
super(menuName);
add(new MenuItem(NEW));
add(new MenuItem(OPEN));
addSeparator();
add(new MenuItem(EXIT));
}
}
class EditMenu extends Menu
{
public final String COPY = "Copy";
public EditMenu(String menuName)
{
super(menuName);
add(new MenuItem(COPY) );
addSeparator();
}
}
Solaris only: Calling setMenuBar() then show() twice causes SIGSEGV.
Steps to reproduce
Compile and run the following code
Select File | New
Select Edit | Copy
// note: receive following error:
SIGSEGV 11* segmentation violation
si_signo [11]: SIGSEGV 11* segmentation violation
si_errno [0]: Error 0
si_code [1]: SEGV_ACCERR [addr: 0x1d]
stackbase=EF2BE000, stackpointer=EF2BCD28
Full thread dump:
"Screen Updater" (TID:0xee300b28, sys_thread_t:0xef1bdde8) prio=4
java.lang.Object.wait(Object.java)
sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:76)
sun.awt.ScreenUpdater.run(ScreenUpdater.java:96)
"AWT-Motif" (TID:0xee3009c0, sys_thread_t:0xef2bdde8) prio=5 *current thread*
sun.awt.motif.MFramePeer.toFront(MFramePeer.java:103)
java.awt.Window.toFront(Window.java:120)
java.awt.Window.show(Window.java:98)
ChangeMenu.menuEvent(ChangeMenu.java:42)
AppFrame.action(AppFrame.java:41)
java.awt.Component.handleEvent(Component.java:886)
AppFrame.handleEvent(AppFrame.java:33)
java.awt.Component.postEvent(Component.java:832)
java.awt.MenuComponent.postEvent(MenuComponent.java:94)
java.awt.MenuComponent.postEvent(MenuComponent.java:94)
java.awt.MenuComponent.postEvent(MenuComponent.java:94)
sun.awt.motif.MMenuItemPeer.action(MMenuItemPeer.java:44)
java.lang.Thread.run(Thread.java)
"AWT-Input" (TID:0xee3009a0, sys_thread_t:0xef47dde8) prio=5
"Finalizer thread" (TID:0xee3002e8, sys_thread_t:0xef537de8) prio=1
"Async Garbage Collector" (TID:0xee300298, sys_thread_t:0xef55ade8) prio=1
"Idle thread" (TID:0xee300228, sys_thread_t:0xef57dde8) prio=0
"clock handler" (TID:0xee300070, sys_thread_t:0xef63dde8) prio=11
"main" (TID:0xee300030, sys_thread_t:0x81ad8) prio=5
Monitor Cache Dump:
ChangeMenu@EE300448/EE334558 (key=0xee300448): monitor owner: "AWT-Motif"
unknown key (key=0xef55ade8): unowned
Waiting to be notified:
"Async Garbage Collector"
sun.awt.ScreenUpdater@EE300B28/EE335A40 (key=0xee300b28): unowned
Waiting to be notified:
"Screen Updater"
sun.awt.motif.MToolkit@EE300988/EE335360 (key=0xee300988): monitor owner: "AWT-Motif"
Waiting to be notified:
"AWT-Input"
unknown key (key=0xef2222a0): monitor owner: "main"
Registered Monitor Dump:
Finalize me queue lock: unowned
Waiting to be notified:
"Finalizer thread"
Thread queue lock: unowned
Waiting to be notified:
"main"
Class lock: unowned
Java stack lock: unowned
Code rewrite lock: unowned
Heap lock: unowned
Has finalization queue lock: unowned
Monitor IO lock: unowned
Child death monitor: unowned
Event monitor: unowned
I/O monitor: unowned
Alarm monitor: unowned
Waiting to be notified:
"clock handler"
Sbrk lock: unowned
Monitor cache lock: unowned
Monitor registry: monitor owner: "AWT-Motif"
Thread Alarm Q:
sys_thread_t 0xef55ade8 [Timeout in 452 ms]
Segmentation Fault (core dumped)
****** Source Code here ******
/* Tests changing a menu bar */
import java.awt.*;
class ChangeMenu extends AppFrame
{
private MenuBar fileMenu;
private MenuBar editMenu;
public ChangeMenu(String name)
{
super(name);
// set new MenuBar
fileMenu = new MenuBar();
fileMenu.add(new FileMenu("File"));
setMenuBar(fileMenu);
editMenu = new MenuBar();
editMenu.add( new EditMenu("Edit") );
resize(200, 200);
}
public boolean menuEvent(Event evt, Object obj)
{
String label = (String) obj;
if (label.equals("New") )
{
remove(fileMenu);
setMenuBar(editMenu);
show();
return true;
}
else if (label.equals("Copy") )
{
remove(editMenu);
setMenuBar(fileMenu);
show();
return true;
}
else
return super.menuEvent(evt, obj);
}
public static void main(String args[])
{
ChangeMenu x = new ChangeMenu("Change Menu Test");
x.show();
}
}
/* Generic Full Application Frame
* @(#)AppFrame.java 1.4 15 Nov 1995 15:48:24
* @author Kevin A. Smith
*
* The class AppFrame provides an AWT Frame window for running
* applications.
*
*/
import java.awt.Frame;
import java.awt.Event;
import java.awt.MenuItem;
// Application Frame window
class AppFrame extends Frame
{
// constructor needed to pass window title to class Frame
public AppFrame(String name)
{
// call java.awt.Frame(String) constructor
super(name);
}
// needed to allow window close
public boolean handleEvent(Event e)
{
// Window Destroy event
if (e.id == Event.WINDOW_DESTROY)
return appExit(0);
// it's good form to let the super class look at any
// unhandled events
return super.handleEvent(e);
} // end handleEvent()
// Generic Action event handler
public boolean action(Event evt, Object obj)
{
if(evt.target instanceof MenuItem)
return menuEvent(evt, obj);
else
// it is good form to let the super class look at any
// unhandled events.
return super.action(evt, obj);
} // end action()
// Generic Menu event handler
public boolean menuEvent(Event evt, Object obj)
{
String menuLabel = obj.toString();
if( menuLabel.equals("Exit") )
{
// This menu item is the same as Close
return appExit(0);
}
else
// menu event handler did nothing with this event.
// In a fully written application, you should never
// get to this line.
return false;
} // end menuEvent()
// application exit code
protected boolean appExit(int exitCode)
{
System.exit(exitCode);
return true;
}
} // end class AppFrame
/* Main Menu bar
*
*/
import java.awt.MenuItem;
import java.awt.Menu;
public class FileMenu extends Menu
{
// standard menu item labels
public final String EXIT = "Exit";
public final String NEW = "New";
public final String OPEN = "Open";
public FileMenu(String menuName)
{
super(menuName);
add(new MenuItem(NEW));
add(new MenuItem(OPEN));
addSeparator();
add(new MenuItem(EXIT));
}
}
class EditMenu extends Menu
{
public final String COPY = "Copy";
public EditMenu(String menuName)
{
super(menuName);
add(new MenuItem(COPY) );
addSeparator();
}
}