← Back to team overview

dx-packages team mailing list archive

[Bug 1241101]

 

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 DX
Packages, which is subscribed to unity in Ubuntu.
Matching subscriptions: dx-packages
https://bugs.launchpad.net/bugs/1241101

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

Status in Eclipse:
  Confirmed
Status in gtk+2.0 package in Ubuntu:
  Triaged
Status in unity package in Ubuntu:
  Invalid
Status in gtk+2.0 package in Suse:
  New

Bug description:
  Running smartgit 4.6.4 on 13.10 64 bits. After registering the
  product, smartgit crash when trying to open a new repository. Java
  error log :

  # A fatal error has been detected by the Java Runtime Environment:
  #
  #  SIGSEGV (0xb) at pc=0x00007fa59061f9c0, pid=12494, tid=140349308167936
  #
  # JRE version: 7.0_25-b30
  # Java VM: OpenJDK 64-Bit Server VM (23.7-b01 mixed mode linux-amd64 compressed oops)
  # Problematic frame:
  # C  [libglib-2.0.so.0+0x389c0]  g_str_hash+0x0

  I tried different version of Java (Oracle v7 and v6 jre) with same
  result. Also, Eclipse display blank menus so there's a general java
  problem with displays.

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