Bug 443327 - MenuBar, Window crash after clicking in the window button
Summary: MenuBar, Window crash after clicking in the window button
Status: CLOSED DUPLICATE of bug 461311
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.4   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2014-09-04 11:17 EDT by Tanio Artino CLA
Modified: 2015-03-04 11:31 EST (History)
6 users (show)

See Also:


Attachments
Screenshot before crash (786.80 KB, image/png)
2014-09-04 14:09 EDT, Tanio Artino CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tanio Artino CLA 2014-09-04 11:17:02 EDT
If two windows are opened and I click the window button in the menu, Eclipse crashs.
Comment 1 Paul Webster CLA 2014-09-04 12:22:36 EDT
Please take a screenshot for before you click and attach it, plus the crash logs (hs_err_<pid>.log for Oracle JVMs)

PW
Comment 2 Tanio Artino CLA 2014-09-04 14:05:00 EDT
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fdfdbd30fe0, pid=17366, tid=140599850489600
#
# JRE version: Java(TM) SE Runtime Environment (7.0_65-b17) (build 1.7.0_65-b17)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libglib-2.0.so.0+0x38fe0]  g_str_hash+0x0
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x00007fdfec00a000):  JavaThread "main" [_thread_in_native, id=17369, stack(0x00007fdff414d000,0x00007fdff424e000)]

siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0000000000000000

Registers:
RAX=0x00007fdfed960460, RBX=0x00007fdfed960460, RCX=0x0000000000000000, RDX=0x00007fdfed960460
RSP=0x00007fdff4249c88, RBP=0x00007fdf90027360, RSI=0x0000000000000000, RDI=0x0000000000000000
R8 =0x00007fdfedcd2ca0, R9 =0x00007fdfec2b29a2, R10=0x0000000000000002, R11=0xaaaaaaaaaaaaaaab
R12=0x00007fdfee0449c0, R13=0x00007fdfee0449c0, R14=0x0000000000000000, R15=0x0000000000000000
RIP=0x00007fdfdbd30fe0, EFLAGS=0x0000000000010206, CSGSFS=0x0000000000000033, ERR=0x0000000000000004
  TRAPNO=0x000000000000000e

Top of Stack: (sp=0x00007fdff4249c88)
0x00007fdff4249c88:   00007fdfdbd30040 00007fdfedf7ec00
0x00007fdff4249c98:   0000000000000000 00007fdfed960460
0x00007fdff4249ca8:   00000000edf7ce20 0000000000000000
0x00007fdff4249cb8:   00007fdfed960460 00007fdfed834780
0x00007fdff4249cc8:   00007fdfee0449c0 00007fdfee0449c0
0x00007fdff4249cd8:   0000000000000000 0000000000000000
0x00007fdff4249ce8:   00007fdfd2957162 00007fdfedeab1b0
0x00007fdff4249cf8:   0000000000000011 00007fdfedf7ceb0
0x00007fdff4249d08:   00007fdfdbd5a178 0000000000000000
0x00007fdff4249d18:   00007fdfedf33860 00007fdfed960460
0x00007fdff4249d28:   00007fdfedeab1b0 0000000000000011
0x00007fdff4249d38:   00007fdfedf7ceb0 00007fdfedd2bed0
0x00007fdff4249d48:   00007fdfd29508e2 0000000000000002
0x00007fdff4249d58:   0000000000000011 00007fdff4249f70
0x00007fdff4249d68:   00007fdfdbd5a483 00007fdfed960460
0x00007fdff4249d78:   00007fdfd3514f00 00007fdfedf33860
0x00007fdff4249d88:   00007fdfed960460 0000000000000002
0x00007fdff4249d98:   00007fdff4249fd0 00007fdff4249f70
0x00007fdff4249da8:   00007fdfd29526ad 00007fdfed960460
0x00007fdff4249db8:   00007fdfd2954ba1 00007fdfedeb46d0
0x00007fdff4249dc8:   00007fdfedeb46d0 00007fdff4249fd0
0x00007fdff4249dd8:   00007fdfec2c8bc0 00007fdff4249fd0
0x00007fdff4249de8:   00007fdfedf7bd60 00007fdfed960460
0x00007fdff4249df8:   00007fdfe0228614 00007fdfed960460
0x00007fdff4249e08:   00007fdfe021ff80 0000000000000000
0x00007fdff4249e18:   00007fdfedf7bd60 0000000000000002
0x00007fdff4249e28:   00007fdff4249fd0 00007fdff4249f70
0x00007fdff4249e38:   00007fdfe021d3b8 0000000000000000
0x00007fdff4249e48:   0000000000000000 0000000040000002
0x00007fdff4249e58:   00007fdfdbd30569 00007fdff424a040
0x00007fdff4249e68:   00007fdfedf268f0 00007fdfec33d790
0x00007fdff4249e78:   00007fdfec2c9e40 00007fdff4249f20 

Instructions: (pc=0x00007fdfdbd30fe0)
0x00007fdfdbd30fc0:   48 83 ec 08 e8 07 12 fe ff 85 c0 0f 94 c0 48 83
0x00007fdfdbd30fd0:   c4 08 0f b6 c0 c3 66 2e 0f 1f 84 00 00 00 00 00
0x00007fdfdbd30fe0:   0f be 17 b8 05 15 00 00 84 d2 74 1a 0f 1f 40 00
0x00007fdfdbd30ff0:   89 c1 48 83 c7 01 c1 e1 05 01 ca 01 d0 0f be 17 

Register to memory mapping:

RAX=0x00007fdfed960460 is an unknown value
RBX=0x00007fdfed960460 is an unknown value
RCX=0x0000000000000000 is an unknown value
RDX=0x00007fdfed960460 is an unknown value
RSP=0x00007fdff4249c88 is pointing into the stack for thread: 0x00007fdfec00a000
RBP=0x00007fdf90027360 is an unknown value
RSI=0x0000000000000000 is an unknown value
RDI=0x0000000000000000 is an unknown value
R8 =0x00007fdfedcd2ca0 is an unknown value
R9 =0x00007fdfec2b29a2 is an unknown value
R10=0x0000000000000002 is an unknown value
R11=0xaaaaaaaaaaaaaaab is an unknown value
R12=0x00007fdfee0449c0 is an unknown value
R13=0x00007fdfee0449c0 is an unknown value
R14=0x0000000000000000 is an unknown value
R15=0x0000000000000000 is an unknown value


Stack: [0x00007fdff414d000,0x00007fdff424e000],  sp=0x00007fdff4249c88,  free space=1011k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libglib-2.0.so.0+0x38fe0]  g_str_hash+0x0

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.eclipse.swt.internal.gtk.OS._gtk_widget_show(J)V+0
j  org.eclipse.swt.internal.gtk.OS.gtk_widget_show(J)V+8
j  org.eclipse.swt.widgets.MenuItem.createHandle(I)V+248
j  org.eclipse.swt.widgets.Widget.createWidget(I)V+2
j  org.eclipse.swt.widgets.MenuItem.<init>(Lorg/eclipse/swt/widgets/Menu;II)V+38
j  org.eclipse.ui.internal.SwitchToWindowMenu.fill(Lorg/eclipse/swt/widgets/Menu;I)V+97
j  org.eclipse.jface.action.MenuManager.doItemFill(Lorg/eclipse/jface/action/IContributionItem;I)V+6
j  org.eclipse.jface.action.MenuManager.update(ZZ)V+371
j  org.eclipse.jface.action.MenuManager.handleAboutToShow()V+33
j  org.eclipse.jface.action.MenuManager.access$1(Lorg/eclipse/jface/action/MenuManager;)V+1
j  org.eclipse.jface.action.MenuManager$2.menuShown(Lorg/eclipse/swt/events/MenuEvent;)V+4
j  org.eclipse.swt.widgets.TypedListener.handleEvent(Lorg/eclipse/swt/widgets/Event;)V+1180
J 936 C2 org.eclipse.swt.widgets.EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V (532 bytes) @ 0x00007fdfe924b740 [0x00007fdfe924b4a0+0x2a0]
j  org.eclipse.swt.widgets.Display.sendEvent(Lorg/eclipse/swt/widgets/EventTable;Lorg/eclipse/swt/widgets/Event;)V+7
j  org.eclipse.swt.widgets.Widget.sendEvent(Lorg/eclipse/swt/widgets/Event;)V+26
j  org.eclipse.swt.widgets.Widget.sendEvent(ILorg/eclipse/swt/widgets/Event;Z)V+73
j  org.eclipse.swt.widgets.Widget.sendEvent(I)V+4
j  org.eclipse.swt.widgets.Menu.gtk_show(J)J+47
j  org.eclipse.swt.widgets.Widget.windowProc(JJ)J+284
j  org.eclipse.swt.widgets.Display.windowProc(JJ)J+18
v  ~StubRoutines::call_stub
j  org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(JZ)Z+0
j  org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(JZ)Z+9
j  org.eclipse.swt.widgets.Display.readAndDispatch()Z+36
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run()V+638
j  org.eclipse.core.databinding.observable.Realm.runWithDefault(Lorg/eclipse/core/databinding/observable/Realm;Ljava/lang/Runnable;)V+12
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(Lorg/eclipse/e4/ui/model/application/MApplicationElement;Lorg/eclipse/e4/core/contexts/IEclipseContext;)Ljava/lang/Object;+57
j  org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(Lorg/eclipse/e4/ui/model/application/MApplicationElement;)V+20
j  org.eclipse.ui.internal.Workbench$5.run()V+310
j  org.eclipse.core.databinding.observable.Realm.runWithDefault(Lorg/eclipse/core/databinding/observable/Realm;Ljava/lang/Runnable;)V+12
j  org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+18
j  org.eclipse.ui.PlatformUI.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+2
j  org.eclipse.ui.internal.ide.application.IDEApplication.start(Lorg/eclipse/equinox/app/IApplicationContext;)Ljava/lang/Object;+111
j  org.eclipse.equinox.internal.app.EclipseAppHandle.run(Ljava/lang/Object;)Ljava/lang/Object;+135
j  org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Ljava/lang/Object;)Ljava/lang/Object;+85
j  org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Ljava/lang/Object;)Ljava/lang/Object;+82
j  org.eclipse.core.runtime.adaptor.EclipseStarter.run(Ljava/lang/Object;)Ljava/lang/Object;+109
j  org.eclipse.core.runtime.adaptor.EclipseStarter.run([Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object;+132
v  ~StubRoutines::call_stub
j  sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j  sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87
j  sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+57
j  org.eclipse.equinox.launcher.Main.invokeFramework([Ljava/lang/String;[Ljava/net/URL;)V+211
j  org.eclipse.equinox.launcher.Main.basicRun([Ljava/lang/String;)V+160
j  org.eclipse.equinox.launcher.Main.run([Ljava/lang/String;)I+4
j  org.eclipse.equinox.launcher.Main.main([Ljava/lang/String;)V+10
v  ~StubRoutines::call_stub
Comment 3 Tanio Artino CLA 2014-09-04 14:09:47 EDT
Created attachment 246742 [details]
Screenshot before crash
Comment 4 Arun Thondapu CLA 2014-09-05 03:21:07 EDT
(In reply to Tanio Artino from comment #0)
> If two windows are opened and I click the window button in the menu, Eclipse
> crashs.

Which version of Linux and GTK+ are you using?

Does it happen only when you launch applications from Eclipse? And does it happen with any set of applications or is it specific to the self-hosted Eclipse Application instances you seem to be running here?
Comment 5 Tanio Artino CLA 2014-09-05 03:32:59 EDT
Specific to the self Hosted application


dpkg -l libgtk* | grep -e '^i' | grep -e 'libgtk-*[0-9]'


ii  libgtk-3-0:amd64       3.10.8-0ubuntu1.2          amd64        GTK+ graphical user interface library
ii  libgtk-3-bin           3.10.8-0ubuntu1.2          amd64        programs for the GTK+ graphical user interface library
ii  libgtk-3-common        3.10.8-0ubuntu1.2          all          common files for the GTK+ graphical user interface library
ii  libgtk2-perl           2:1.249-2                  amd64        Perl interface to the 2.x series of the Gimp Toolkit library
ii  libgtk2.0-0:amd64      2.24.23-0ubuntu1.1         amd64        GTK+ graphical user interface library
ii  libgtk2.0-bin          2.24.23-0ubuntu1.1         amd64        programs for the GTK+ graphical user interface library
ii  libgtk2.0-cil          2.12.10-5                  amd64        CLI binding for the GTK+ toolkit 2.12
ii  libgtk2.0-common       2.24.23-0ubuntu1.1         all          common files for the GTK+ graphical user interface library
Comment 6 Tanio Artino CLA 2014-09-05 03:38:02 EDT
Ubuntu 14.04
Comment 7 Istvan Sarandi CLA 2014-10-19 11:31:31 EDT
It also happens to me on Ubuntu 14.04. I tried Eclipse Luna, Kepler and Mars. All are affected. I use the default Ubuntu setup. 
Steps to reproduce:
Open Eclipse. Click Window -> New Window. Now click click the Window menu on top of the newly created window.
Result: Eclipse crashes (both windows disappear).

I used OpenJDK 1.7. If I switch to Orcale's JDK 1.8 then the windows don't disappear right away. Their contents are greyed out but I can still drop down the menus. In a couple of seconds, the windows disappear.
Comment 8 Stefan Xenos CLA 2014-12-05 22:13:32 EST
Here's some things I've learned:

- Setting UBUNTU_MENUPROXY=0 causes the crash to go away.
- Closing one of the windows causes the crash to go away .
- The crash appears related to radio buttons. When you have two or more workbench windows open, the Window menu gets radio buttons near the bottom of the menu, and these are the only radio buttons on the menubar.


The actual crash occurs inside the JNI call _1gtk_1widget_1show, which looks like this:

JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1show)
       (JNIEnv *env, jclass that, jintLong arg0)
{
       OS_NATIVE_ENTER(env, that, _1gtk_1widget_1show_FUNC);
       gtk_widget_show((GtkWidget *)arg0);
       OS_NATIVE_EXIT(env, that, _1gtk_1widget_1show_FUNC);
}

From this, I suspect a bad handle (or a handle attached to bad data). Looking up through the stack trace, the handle seems to have been allocated in this method (in MenuItem.java):

void createHandle (int index) {
       state |= HANDLE;
       byte [] buffer = new byte [1];
       int bits = SWT.CHECK | SWT.RADIO | SWT.PUSH | SWT.SEPARATOR;
       switch (style & bits) {
               case SWT.SEPARATOR:
                       handle = OS.gtk_separator_menu_item_new ();
                       break;
               case SWT.RADIO:
                       /*
                       * Feature in GTK.  In GTK, radio button must always be part of
                       * a radio button group.  In a GTK radio group, one button is always
                       * selected.  This means that it is not possible to have a single
                       * radio button that is unselected.  This is necessary to allow
                       * applications to implement their own radio behavior or use radio
                       * buttons outside of radio groups.  The fix is to create a hidden
                       * radio button for each radio button we create and add them
                       * to the same group.  This allows the visible button to be
                       * unselected.
                       */
                       groupHandle = OS.gtk_radio_menu_item_new (0);
                       if (groupHandle == 0) error (SWT.ERROR_NO_HANDLES);
                       OS.g_object_ref (groupHandle);
                       OS.g_object_ref_sink (groupHandle);
                       long /*int*/ group = OS.gtk_radio_menu_item_get_group (groupHandle);
                       handle = OS.gtk_radio_menu_item_new_with_label (group, buffer);
                       break;
               case SWT.CHECK:
                       handle = OS.gtk_check_menu_item_new_with_label (buffer);
                       break;
               case SWT.PUSH:
               default:
                       handle = OS.gtk_image_menu_item_new_with_label (buffer);
                       break;
       }
       if (handle == 0) error (SWT.ERROR_NO_HANDLES);
       if ((style & SWT.SEPARATOR) == 0) {
               long /*int*/ label = OS.gtk_bin_get_child (handle);
               OS.gtk_accel_label_set_accel_widget (label, 0);
       }
       long /*int*/ parentHandle = parent.handle;
       boolean enabled = gtk_widget_get_sensitive (parentHandle);
       if (!enabled) OS.gtk_widget_set_sensitive (parentHandle, true);
       OS.gtk_menu_shell_insert (parentHandle, handle, index);
       if (!enabled) OS.gtk_widget_set_sensitive (parentHandle, false);
       OS.gtk_widget_show (handle);
}


The handle must not have been 0 since the line "if (handle == 0) error (SWT.ERROR_NO_HANDLES);" would have thrown a RuntimeException.

So if the handle is improperly initialized, it probably was a non-null handle that came from GTK -- most likely from this line (since it seems to be caused by radio buttons):

                       groupHandle = OS.gtk_radio_menu_item_new (0);
                       if (groupHandle == 0) error (SWT.ERROR_NO_HANDLES);
                       OS.g_object_ref (groupHandle);
                       OS.g_object_ref_sink (groupHandle);
                       long /*int*/ group = OS.gtk_radio_menu_item_get_group (groupHandle);
                       handle = OS.gtk_radio_menu_item_new_with_label (group, buffer);


The comment in the SWT.RADIO case looks suspicious. It talks about creating a second invisible radio button in the same group, but I don't see this happening. What I do see happening is the creation of a group and the rather strange pattern of creating and then immediately destroying a reference to it. Could this be a leftover from an older workaround that is now causing problems?
Comment 9 Arun Thondapu CLA 2015-03-04 11:31:57 EST
Closing as duplicate of 461311 as that bug has been marked as a tracking bug for Ubuntu launchpad report for this issue -  https://bugs.launchpad.net/ubuntu/+source/unity-gtk-module/+bug/1427866

*** This bug has been marked as a duplicate of bug 461311 ***