Created attachment 256390
Patch

Hi. I have looked into this problem and came up with the following
workaround patch that still uses Unity and avoids the crash.

I found that the crash occurs because a new Radio menu is created with *empty 
label*
for which unity_gtk_action_group_get_state_name() returns null and this ends up 
with a null-pointer dereference at g_str_hash().

My suggestion is to modify _1gtk_1radio_1menu_1item_1new_1with_1label() in os.c 
to call gtk_radio_menu_item_new_with_label() with an arbitrary, non-empty 
string if the
given string for label is for empty string (2nd parameter). In this patch, I 
used the string with one space (" ") as an arbitrary text.

I confirmed that, with this patch, the test given by Thomas Singer passes and 
all tests in Test_org_eclipse_swt_widgets_MenuItem.java pass as well. 
Please let me know if you have any question or suggestion for this patch. 
Thanks.


--- "a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c" 2013-05-14 
11:50:23.000000000 +0900
+++ "b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c" 2015-09-04 
19:49:40.768009600 +0900
@@ -13868,7 +13868,10 @@ JNIEXPORT jintLong JNICALL 
OS_NATIVE(_1gtk_1radio_1menu_1item_1new_1with_1label)
    jintLong rc = 0;
    OS_NATIVE_ENTER(env, that, _1gtk_1radio_1menu_1item_1new_1with_1label_FUNC);
    if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == 
NULL) goto fail;
-   rc = (jintLong)gtk_radio_menu_item_new_with_label((GSList *)arg0, (const 
gchar *)lparg1);
+   if (lparg1[0] == '\0')
+       rc = (jintLong)gtk_radio_menu_item_new_with_label((GSList *)arg0, 
(const gchar *)" ");
+   else
+       rc = (jintLong)gtk_radio_menu_item_new_with_label((GSList *)arg0, 
(const gchar *)lparg1);
 fail:
    if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
    OS_NATIVE_EXIT(env, that, _1gtk_1radio_1menu_1item_1new_1with_1label_FUNC);

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gtk+2.0 in Ubuntu.
https://bugs.launchpad.net/bugs/1241101

Title:
  Java crash in libglib-2.0 after upgrade from 13.04 to 13.10

To manage notifications about this bug go to:
https://bugs.launchpad.net/eclipse/+bug/1241101/+subscriptions

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to