2
# Ubuntu: https://bugs.launchpad.net/ubuntu/+source/notification-daemon/+bug/1312277
4
# Description: When you change theme with notification-properties and press preview button,
5
# the notification-daemon crashes and notification-properties gets an error message.
6
# The problem depends on closing unproperly the module (engine->module) because it is closing when it is still
7
# in use. The patch concerns a correct way to close G_Modules and destroy engine.
8
# First it destroys widget notification, then it decreases "engine->ref_count" and if requested (engine->ref_count == 0),
9
# it destroys engine. These steps will be made by the function theme_destroy_widget, that will have to be called every-time
10
# you want to destroy notification widget (daemon.c).
12
#Practically the daemon destroys engine, in particular "engine->module", when it is already used by the notification pop-up.
13
#The correct way to destroy engine is this:
14
# -) Destroy notification pop-up by calling "gtk_distroy_widget".
15
# -) Decrease value of "engine->ref_count" and if it is equal to zero, unload engine->module and destroy engine.
17
#Currently the daemon works in this modality:
18
# -) It calls the invokes the destruction of a notification pop-up by calling "gtk_destroy_widget", but with this event is also called "theme_engine_unref".
19
# -) It decreases value of "engine->ref_count" and if it is equal to zero, it unloads "engine->module" and destroys "engine".
20
# -) It ends the destruction of a notification pop-up.
22
#The daemon unloads engine->module when it is still in use by gtk_widget.
23
diff -Nur -x '*.orig' -x '*~' notification-daemon-0.4.0/src/daemon/daemon.c notification-daemon-0.4.0.new/src/daemon/daemon.c
24
--- notification-daemon-0.4.0/src/daemon/daemon.c 2009-03-19 11:22:39.000000000 +0100
25
+++ notification-daemon-0.4.0.new/src/daemon/daemon.c 2009-03-19 11:25:22.000000000 +0100
28
_notify_timeout_destroy(NotifyTimeout *nt)
30
- gtk_widget_destroy(GTK_WIDGET(nt->nw));
31
+ theme_destroy_notification(GTK_WIDGET(nt->nw));
35
diff -Nur -x '*.orig' -x '*~' notification-daemon-0.4.0/src/daemon/engines.c notification-daemon-0.4.0.new/src/daemon/engines.c
36
--- notification-daemon-0.4.0/src/daemon/engines.c 2008-11-20 11:45:16.000000000 +0100
37
+++ notification-daemon-0.4.0.new/src/daemon/engines.c 2009-03-19 11:25:15.000000000 +0100
39
ThemeEngine *engine = get_theme_engine();
40
GtkWindow *nw = engine->create_notification(url_clicked_cb);
41
g_object_set_data_full(G_OBJECT(nw), "_theme_engine", engine,
42
- (GDestroyNotify)theme_engine_unref);
48
engine->destroy_notification(nw);
50
gtk_widget_destroy(GTK_WIDGET(nw));
51
+ theme_engine_unref(engine);