After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 463773 - Openoffice and flash run into a deadlock when used with KDE
Openoffice and flash run into a deadlock when used with KDE
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
1.0.x
Other Linux
: Normal critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2007-08-05 21:52 UTC by Jan de Groot
Modified: 2009-05-13 15:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
workaround the issue (532 bytes, patch)
2007-09-05 15:12 UTC, Sebastien Bacher
rejected Details | Review

Description Jan de Groot 2007-08-05 21:52:00 UTC
Since glib 2.13.x and 2.14.0, any gtk compiled against this version of glib locks up openoffice.org or flash when used from a KDE environment.

Reverting the commit in revision 5618 of glib/gobject/gtype.h and recompiling GTK makes it work again.

Some backtrace from OpenOffice at the moment it hangs:
(gdb) bt
  • #0 IA__g_slist_find
    at gslist.c line 369
  • #1 IA__g_once_init_enter_impl
    at gthread.c line 214
  • #2 IA__gdk_screen_get_type
    at /usr/include/glib-2.0/glib/gthread.h line 338
  • #3 IA__gdk_screen_get_font_options
    at gdkscreen.c line 420
  • #4 psp::PrintFontManager::getFontConfigHints
    from /opt/openoffice/program/libpsp680li.so

It's clear that OpenOffice doesn't initialize GTK correctly, we get 3 assertions for this already (Critical ones). Because GTK wasn't initialized correctly, screen is NULL. GTK checks if 0x0 is a valid screen and uses a macro for this, which hits the new macros introduced in the last revision of gtype.h. Because the type system isn't initialized correctly, this one goes into a deadlock.
I don't have a trace of flash when used from Opera or Konqueror, but it's likely these applications suffer from the same issue, both applications are non-GTK and flashplayer is a closed application we don't have any influence on.
Comment 1 Jan de Groot 2007-08-06 06:38:48 UTC
Checked flash when used from Konqueror, it gives the same assertions (one about that it needs to run g_type_init() before using any g_type function, one about that there's no GDK screen and another one which I don't remember).

This happens with both gtk 2.10.14 and gtk 2.10.6 when compiled against Glib 2.13 or Glib 2.14
Comment 2 Tim Janik 2007-08-14 00:19:57 UTC
if you see assertions such as "gtype.c:2242: initialization assertion failed, use IA__g_type_init() prior to this function", it's a GNUC_CONST/gcc issue, caused by gcc moving _get_type functions around to before gtk_init or g_type_init, bug #446565 has the proper fix for that (you failed to post the assertions you're seeing so this is just guess work).
if you really ran into a g_once_init_enter_impl race however, that should be fixed by:
Tue Aug 14 02:06:10 2007  Tim Janik  <timj@imendio.com>

        * glib/gthread.c (g_once_init_enter_impl): prevent race covered
        by g_once_init_enter(), by checking for previous initializations
        before entering initialisation branch.

        * tests/onceinit.c: added multi-thread/multi-initializer stress test
        using unoptimized g_once_init_enter_impl().
Comment 3 Tim Janik 2007-08-14 10:44:05 UTC
(In reply to comment #0)
> Since glib 2.13.x and 2.14.0, any gtk compiled against this version of glib
> locks up openoffice.org or flash when used from a KDE environment.
> 
> Reverting the commit in revision 5618 of glib/gobject/gtype.h and recompiling
> GTK makes it work again.
> 
> Some backtrace from OpenOffice at the moment it hangs:
> (gdb) bt
> #0  IA__g_slist_find (list=0x8185d00, data=0xb44e9e5c) at gslist.c:369
> #1  0xb42f9223 in IA__g_once_init_enter_impl (value_location=0xb44e9e5c)
>     at gthread.c:214

please try a recent glib freshly from SVN. if the problem still persists, please (re-)open a bug report with the following information:

- does the problem happen *every* time or infrequently?
- does it occour on multiple platforms (x86?) or is it platform specific?
- please send me (better yet: try to fix) ALL warnings/criticals
  that glib is producing before the problem occours.
- please send me the source file (or a link) which implements the
  particular g_once_init_enter() call in which you see the problem
  (might be called from a _get_type function or G_DEFINE_TYPE()).
Comment 4 Jan de Groot 2007-08-14 18:23:03 UTC
[jan@laptop ~]$ OOO_FORCE_DESKTOP=kde soffice
libGL warning: 3D driver claims to not support visual 0x67

(process:27918): GLib-GObject-CRITICAL **: gtype.c:2242: initialization assertion failed, use IA__g_type_init() prior to this function

(process:27918): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

(process:27918): Gdk-CRITICAL **: gdk_screen_get_font_options: assertion `GDK_IS_SCREEN (screen)' failed
<hangs here>

- happens every time OpenOffice is launched in KDE mode
- happens on AMD64 and i686
- assertions: see above
- source: see GTK source for gdk_screen_get_font_options, it checks if the screen is a screen type and calls get_type on the NULL screen. Due to the changed macro in the original bugreport, this goes into g_once_init_enter.
Comment 5 Tim Janik 2007-08-14 21:51:02 UTC
(In reply to comment #4)
> [jan@laptop ~]$ OOO_FORCE_DESKTOP=kde soffice
> libGL warning: 3D driver claims to not support visual 0x67
> 
> (process:27918): GLib-GObject-CRITICAL **: gtype.c:2242: initialization
> assertion failed, use IA__g_type_init() prior to this function

the first assertion indicates that you're calling a _get_type function (or gdk_screen_get_font_options() respectively) prior to gtk_init.
after this assertion, *anything* can happen, the recent g_once_init_* changes just tend to make "anything" more fatal. simply fix getFontConfigHints() to call into gdk only after gtk (gdk) has been initialized.
Comment 6 Jan de Groot 2007-08-14 21:56:54 UTC
Ok, so tell me to fix the flashplugin then, which has the same assertions. As a distribution maintainer, this is not acceptable. All these things worked fine with glib 2.12, but not with glib 2.14, so this is a regression. As a distribution, I have to revert the patch or keep things at gnome 2.18 to keep all things working.
Comment 7 Tim Janik 2007-08-14 22:06:58 UTC
(In reply to comment #6)
> Ok, so tell me to fix the flashplugin then, which has the same assertions. As a
> distribution maintainer, this is not acceptable. All these things worked fine
> with glib 2.12, but not with glib 2.14, so this is a regression. As a
> distribution, I have to revert the patch or keep things at gnome 2.18 to keep
> all things working.

unless reverting the patch would get rid of the assertions, there is no way this could be fixed in glib.
Comment 8 Jan de Groot 2007-08-14 22:18:20 UTC
The assertions have always been there inside a non-GTK environment. With glib 2.12 and below, these programs have worked always. With GTK compiled with glib 2.14, they hangup your complete browser (Opera, Konqueror) or the application itself (OpenOffice).
Since this change has been introduced in glib 2.13.x, GTK does something completely different for gdk_screen_get_type when compiled against these new versions of glib.

It's either reverting this new behaviour, or changing the check in GTK (screen is always 0x0 in both flashplugin and Openoffice during these calls, so gdk_screen_get_type could check for NULL before actually executing the call).
Comment 9 Jan de Groot 2007-08-14 22:22:55 UTC
This is the flashplugin in action in konqueror btw:

(process:869): GLib-GObject-CRITICAL **: gtype.c:2242: initialization assertion failed, use IA__g_type_init() prior to this function

(process:869): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

(process:869): Gtk-CRITICAL **: gtk_clipboard_get_for_display: assertion `GDK_IS_DISPLAY (display)' failed
Adobe FlashPlayer: gtk_clipboard_get(GDK_SELECTION_PRIMARY); failed. Trying to call gtk_init(0,0);
Comment 10 Jan de Groot 2007-08-18 14:11:23 UTC
For anyone who is looking for a solution to this problem:
I "fixed" the flashplugin case by adding an extra patch to GTK for now:

Flashplugin checks using gtk_clipboard_get(GDK_SELECTION_PRIMARY) to see if GTK is available, if not, it calls gtk_init to initialize this.

With the new glib 2.14 changes, the gtk_clipboard_get_for_display function checks for the display type, which is 0x0 in case of flashplugin. I added another check to this function, before GDK_IS_DISPLAY(display) is used to check for a valid display:

if (display == NULL) return NULL;

This fixes the flash crash, as it gets a NULL from that function without assertion, calls gtk_init and from that point all is fine again.

For OpenOffice, exporting two environment variables is enough to force GTK initialization. Fedora has a patch for this:
http://cvs.fedora.redhat.com/viewcvs/devel/openoffice.org/openoffice.org-1.9.88.rh133741.alwaysgtk.desktop.patch?rev=1.6&view=markup
Comment 11 Sebastien Bacher 2007-09-05 15:12:01 UTC
Created attachment 94996 [details] [review]
workaround the issue

We use this patch in the Ubuntu GTK package, that makes the non-free flash work again
Comment 12 Matthias Clasen 2007-09-07 19:39:05 UTC
I guess we should probably release note this.
Comment 13 Matthias Clasen 2007-09-07 19:42:10 UTC
I guess we should probably release note this.
Comment 14 Matthias Clasen 2007-09-09 04:34:20 UTC
I've added a note to README.in. Please review.
Comment 15 Tim Janik 2007-09-09 16:32:54 UTC
(In reply to comment #14)
> I've added a note to README.in. Please review.

reviewed, thanks.
Comment 16 martin yazdzik 2007-10-08 19:37:52 UTC
Dear Friends,

Okay, so for the non programmer who ends up at this bug via google,
how do I fix the mess?
libgtk 2.12.0-2(sebastian is listed as the maintainer, so I am presuming that running debian sid this should not be happening...)
glibc is 2.14.1-5


Best wishes,

Martin
Comment 17 Federico Mena Quintero 2009-05-12 19:19:17 UTC
I just committed the "g_return_if_fail (...)" patch to gtk+:

master - commit 4134c346f9e68367e515345c0ded07aa2b857a1a
gtk-2-16 - commit e2bce0d630c6f424664e81ee95352c4cbc41fc27
Comment 18 Tim Janik 2009-05-13 15:21:52 UTC
(In reply to comment #17)
> I just committed the "g_return_if_fail (...)" patch to gtk+:
> 
> master - commit 4134c346f9e68367e515345c0ded07aa2b857a1a
> gtk-2-16 - commit e2bce0d630c6f424664e81ee95352c4cbc41fc27

Federico, the patch is useless. It adds a display!=NULL check next to GDK_IS_DISPLAY(display). Like all other object types, the GDK_IS_DISPLAY() macro is implemented with G_TYPE_CHECK_INSTANCE_TYPE() which already checks for NULL instances.