[Galago-devel] question on libnotify usage, specifically relating to freeing up a notification

Gregory Hosler ghosler at redhat.com
Wed Dec 19 20:33:07 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I've gone thru the devhelp documentation on libnotify, and have been
able to successfully incorporate libnotify into my application.

I am curious as regards to releasing the memory / structures that are
used by a NotifyNotification.

My code is as follows:

	NotifyNotification* my_popup;
	GdkPixbufLoader *my_loader;
	GdkPixbuf *jpg_pixbuf;
	GError *my_error;
	int rv;

	my_popup=notify_notification_new(mytitle, mymsg, NULL,
systray_get_widget());
	if (icon_pixbuf) {
		notify_notification_set_icon_from_pixbuf(my_popup, icon_pixbuf);
		g_object_unref(icon_pixbuf);
	}
	notify_notification_set_timeout(my_popup, timeout);
	my_error = 0;
	rv = notify_notification_show(my_popup, &my_error);


Everything works as expected. The notifications show, they timeout and
disappear. But it seems as though they are never freed/destroyed. When I
run valgrind on my application, I am seeing:

==6969== 10,240 bytes in 5 blocks are still reachable in loss record
13,858 of 13,883
==6969==    at 0x4005622: realloc (vg_replace_malloc.c:306)
==6969==    by 0x26B91A: g_realloc (gmem.c:168)
==6969==    by 0x24601F: g_array_maybe_expand (garray.c:339)
==6969==    by 0x2467D8: g_array_append_vals (garray.c:132)
==6969==    by 0xA9487E: (within /usr/lib/libdbus-glib-1.so.2.1.0)
==6969==    by 0xA937A3: (within /usr/lib/libdbus-glib-1.so.2.1.0)
==6969==    by 0x3B8569: g_value_copy (gvalue.c:119)
==6969==    by 0x3B8B3B: g_value_array_insert (gvaluearray.c:177)
==6969==    by 0x3B8C5D: g_value_array_append (gvaluearray.c:153)
==6969==    by 0xDEF822: notify_notification_set_icon_from_pixbuf
(notification.c:894)

as well as a number of other of instances of "still reachable in loss
record" ...

So my question is: what happens when the notification "times out". Is it
destroyed ?

Same question when you click on teh notification to dismiss it.

Are there any objects that are put into the notification that need to be
"unref"'ed ?

Thank you, and best rgds,

- -Greg

- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler at redhat.com    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHafCB404fl/0CV/QRArumAJ9XyGqeDmCBmlXKExV5h/ev138T+ACcDIO3
+llrVQ8mJ1rnDv3czlp/z9g=
=F4Te
-----END PGP SIGNATURE-----


More information about the galago-devel mailing list