[eog] Emit the window's "prepared" signal from the main loop's thread



commit 5515f5c05186dc221abcbd4d028faefe52b71b5d
Author: Felix Riemann <friemann gnome org>
Date:   Wed Jul 1 22:10:48 2009 +0200

    Emit the window's "prepared" signal from the main loop's thread
    
    This simplifies the signal handler and should fix crashes with plugins
    using Clutter (at least Clutter-0.8) and possibly more.

 ChangeLog             |    9 +++++++++
 src/eog-application.c |    4 ----
 src/eog-window.c      |   12 +++++++++++-
 3 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5bfcaf9..10d3c55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-07-01  Felix Riemann  <friemann gnome org>
+
+	* src/eog-application.c (eog_application_show_window):
+	* src/eog-window.c (emit_window_prepared_signal),
+	(eog_window_obtain_desired_size):
+	Emit the window's "prepared" signal from the main loop's thread.
+	This make the handler easier and should fix crashes with plugins
+	using Clutter (at least Clutter-0.8).
+
 2009-06-16  Felix Riemann  <friemann svn gnome org>
 
 	* configure.ac: Post-release version bump.
diff --git a/src/eog-application.c b/src/eog-application.c
index f47e890..f8d5fb3 100644
--- a/src/eog-application.c
+++ b/src/eog-application.c
@@ -276,12 +276,8 @@ eog_application_get_file_window (EogApplication *application, GFile *file)
 static void
 eog_application_show_window (EogWindow *window, gpointer user_data)
 {
-	gdk_threads_enter ();
-
 	gtk_window_present_with_time (GTK_WINDOW (window),
 				      GPOINTER_TO_UINT (user_data));
-
-	gdk_threads_leave ();
 }
 
 /**
diff --git a/src/eog-window.c b/src/eog-window.c
index 58db63d..709e4df 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -1292,6 +1292,14 @@ eog_job_save_progress_cb (EogJobSave *job, float progress, gpointer user_data)
 		image = NULL;
 }
 
+static gboolean
+emit_window_prepared_signal (EogWindow *window)
+{
+	g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
+
+	return FALSE;
+}
+
 static void
 eog_window_obtain_desired_size (EogImage  *image,
 				gint       width,
@@ -1367,7 +1375,9 @@ eog_window_obtain_desired_size (EogImage  *image,
 
 	gdk_threads_leave ();
 
-	g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
+	gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
+				   (GSourceFunc) emit_window_prepared_signal,
+				   g_object_ref (window), g_object_unref);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]