File notification-daemon-crash-theme-change.patch of Package notification-daemon

Index: notification-daemon-0.4.0/src/daemon/daemon.c
===================================================================
--- notification-daemon-0.4.0.orig/src/daemon/daemon.c
+++ notification-daemon-0.4.0/src/daemon/daemon.c
@@ -77,6 +77,7 @@ const PopupNotifyStackLocation popup_sta
 
 typedef struct
 {
+	NotifyDaemon *daemon;
 	GTimeVal expiration;
 	GTimeVal paused_diff;
 	gboolean has_timeout;
@@ -117,6 +118,7 @@ struct _DBusGMethodInvocation
 #endif /* D-BUS < 0.60 */
 
 static void notify_daemon_finalize(GObject *object);
+static void _notification_destroyed_cb(GtkWindow *nw, NotifyDaemon *daemon);
 static void _close_notification(NotifyDaemon *daemon, guint id,
 								gboolean hide_notification,
 								NotifydClosedReason reason);
@@ -147,6 +149,13 @@ notify_daemon_class_init(NotifyDaemonCla
 static void
 _notify_timeout_destroy(NotifyTimeout *nt)
 {
+	/* Disconnect the destroy handler to avoid a loop since the id
+	 * won't be removed from the hash table before the widget is
+	 * destroyed */
+	g_signal_handlers_disconnect_by_func(nt->nw,
+					     _notification_destroyed_cb,
+					     nt->daemon);
+
 	gtk_widget_destroy(GTK_WIDGET(nt->nw));
 	g_free(nt);
 }
@@ -582,6 +591,7 @@ _store_notification(NotifyDaemon *daemon
 	nt = g_new0(NotifyTimeout, 1);
 	nt->id = id;
 	nt->nw = nw;
+	nt->daemon = daemon;
 
 	_calculate_timeout(daemon, nt, timeout);
 
Index: notification-daemon-0.4.0/src/daemon/engines.c
===================================================================
--- notification-daemon-0.4.0.orig/src/daemon/engines.c
+++ notification-daemon-0.4.0/src/daemon/engines.c
@@ -114,13 +114,25 @@ destroy_engine(ThemeEngine *engine)
 	g_free(engine);
 }
 
+static gboolean
+theme_engine_destroy(ThemeEngine *engine)
+{
+	destroy_engine(engine);
+	return FALSE;
+}
+
 static void
 theme_engine_unref(ThemeEngine *engine)
 {
 	engine->ref_count--;
 
 	if (engine->ref_count == 0)
-		destroy_engine(engine);
+		/* Destroy the engine in an idle loop since the last reference 
+		 * might have been the one of a notification which is being
+		 * destroyed and that still has references to the engine
+		 * module. This way, we're sure the notification is completely
+		 * destroyed before the engine is. */
+		g_idle_add((GSourceFunc) theme_engine_destroy, engine);
 }
 
 static void
openSUSE Build Service is sponsored by