~gilir/+junk/notification-daemon-0.5.0-2

« back to all changes in this revision

Viewing changes to debian/patches/09_change_themes_crash_rev1.patch

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2009-04-22 13:19:20 UTC
  • Revision ID: james.westby@ubuntu.com-20090422131920-byzww67djk7w8hk6
Tags: 0.4.0-0ubuntu4
* debian/patches/09_change_themes_crash_rev1.patch resolve (LP: #131227)
  - fix crash when changing themes (based on the patch from 
    Antonio Litterio, many thanks)
* debian/rules:
  - build without "-Wl,--as-needed" to avoid another crash releated
    to loading/unloading libsexy from the themes (LP: #131227)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Ubuntu: https://bugs.launchpad.net/ubuntu/+source/notification-daemon/+bug/1312277
 
3
#
 
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).  
 
11
#
 
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.
 
16
#
 
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.
 
21
#
 
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
 
26
@@ -147,7 +147,7 @@
 
27
 static void
 
28
 _notify_timeout_destroy(NotifyTimeout *nt)
 
29
 {
 
30
-       gtk_widget_destroy(GTK_WIDGET(nt->nw));
 
31
+        theme_destroy_notification(GTK_WIDGET(nt->nw));
 
32
        g_free(nt);
 
33
 }
 
34
 
 
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
 
38
@@ -182,7 +182,7 @@
 
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);
 
43
+                                                  NULL);
 
44
        engine->ref_count++;
 
45
        return nw;
 
46
 }
 
47
@@ -196,6 +196,7 @@
 
48
                engine->destroy_notification(nw);
 
49
        else
 
50
                gtk_widget_destroy(GTK_WIDGET(nw));
 
51
+       theme_engine_unref(engine);
 
52
 }
 
53
 
 
54
 void