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 721755 - Don't call gdk_threads_init()
Don't call gdk_threads_init()
Status: RESOLVED FIXED
Product: eog
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: EOG Maintainers
EOG Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-07 23:13 UTC by Lars Karlitski
Modified: 2014-01-11 17:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't call gdk_threads_init() (1.48 KB, patch)
2014-01-07 23:13 UTC, Lars Karlitski
none Details | Review
Don't call gdk_threads_init() (1.38 KB, patch)
2014-01-09 21:49 UTC, Lars Karlitski
none Details | Review

Description Lars Karlitski 2014-01-07 23:13:36 UTC
This fixes a deadlock on ubuntu when accessing file/save or file/print from
unity's global menu[1].

I'm not sure what else could be affected by removing gdk threading. Do some
plugins depend on it?

[1] https://bugs.launchpad.net/ubuntu/+source/eog/+bug/1262801
Comment 1 Lars Karlitski 2014-01-07 23:13:38 UTC
Created attachment 265613 [details] [review]
Don't call gdk_threads_init()

Accessing gdk from outside the main thread is deprecated.

This also replaces an occurence of gdk_threads_add_idle_full() with an
idle source that is dispatched to the main thread.
Comment 2 Felix Riemann 2014-01-09 20:13:14 UTC
Review of attachment 265613 [details] [review]:

::: src/eog-image.c
@@ +502,3 @@
+	g_source_attach (idle, NULL);
+
+	g_source_unref (idle);

I think you reimplemented g_idle_add_full() here...

I am not sure if that alone is sufficient or if we actually need the GDK lock.

The background here was AFAIR that this signal is caused by the image loading thread, which caused some problems with the application window not showing, as the signal handler was realizing/showing the window from the loading thread instead of the mainloop.
Comment 3 Lars Karlitski 2014-01-09 21:49:02 UTC
Created attachment 265878 [details] [review]
Don't call gdk_threads_init()

Ah, of course. I had it dispatch to a thread-local main context before and
changed that to NULL after Ryan reviewed it. Thanks.

I think we don't need the GDK lock anymore because the idle is dispatched to
the default main context (which runs in the main thread).
Comment 4 Felix Riemann 2014-01-11 17:31:45 UTC
Alright, I found the commit where I introduced the GDK lock and it was a problem whith Clutter and strict display drivers. But the standard idle_add should achieve everything that's needed in that case. So, thanks for patching. :)

commit 757128bc3792cca59115df3b956bffedd3732214
Author: Lars Uebernickel <>
Date:   Tue Jan 7 12:18:19 2014 +0100

    Don't call gdk_threads_init()
    
    Accessing gdk from outside the main thread is deprecated.
    
    This also replaces an occurence of gdk_threads_add_idle_full() with an
    idle source that is dispatched to the main thread.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721755
---
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.