Hi.<br><br>In your usage below, you want to call g_object_unref on the notification after you&#39;ve shown it. You won&#39;t need it around unless you&#39;re dealing with updating it or handling multiple actions, in which case you&#39;d then want to unref when you&#39;re finished with it then. I recommend looking at libnotify/tests/ for some examples on this.
<br><br>Christian<br><br><br><div class="gmail_quote">On Dec 19, 2007 8:33 PM, Gregory Hosler &lt;<a href="mailto:ghosler@redhat.com">ghosler@redhat.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>Hi all,<br><br>I&#39;ve gone thru the devhelp documentation on libnotify, and have been<br>able to successfully incorporate libnotify into my application.<br><br>I am curious as regards to releasing the memory / structures that are
<br>used by a NotifyNotification.<br><br>My code is as follows:<br><br> &nbsp; &nbsp; &nbsp; &nbsp;NotifyNotification* my_popup;<br> &nbsp; &nbsp; &nbsp; &nbsp;GdkPixbufLoader *my_loader;<br> &nbsp; &nbsp; &nbsp; &nbsp;GdkPixbuf *jpg_pixbuf;<br> &nbsp; &nbsp; &nbsp; &nbsp;GError *my_error;<br> &nbsp; &nbsp; &nbsp; &nbsp;int rv;
<br><br> &nbsp; &nbsp; &nbsp; &nbsp;my_popup=notify_notification_new(mytitle, mymsg, NULL,<br>systray_get_widget());<br> &nbsp; &nbsp; &nbsp; &nbsp;if (icon_pixbuf) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;notify_notification_set_icon_from_pixbuf(my_popup, icon_pixbuf);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;g_object_unref(icon_pixbuf);
<br> &nbsp; &nbsp; &nbsp; &nbsp;}<br> &nbsp; &nbsp; &nbsp; &nbsp;notify_notification_set_timeout(my_popup, timeout);<br> &nbsp; &nbsp; &nbsp; &nbsp;my_error = 0;<br> &nbsp; &nbsp; &nbsp; &nbsp;rv = notify_notification_show(my_popup, &amp;my_error);<br><br><br>Everything works as expected. The notifications show, they timeout and
<br>disappear. But it seems as though they are never freed/destroyed. When I<br>run valgrind on my application, I am seeing:<br><br>==6969== 10,240 bytes in 5 blocks are still reachable in loss record<br>13,858 of 13,883<br>
==6969== &nbsp; &nbsp;at 0x4005622: realloc (vg_replace_malloc.c:306)<br>==6969== &nbsp; &nbsp;by 0x26B91A: g_realloc (gmem.c:168)<br>==6969== &nbsp; &nbsp;by 0x24601F: g_array_maybe_expand (garray.c:339)<br>==6969== &nbsp; &nbsp;by 0x2467D8: g_array_append_vals (
garray.c:132)<br>==6969== &nbsp; &nbsp;by 0xA9487E: (within /usr/lib/libdbus-glib-1.so.2.1.0)<br>==6969== &nbsp; &nbsp;by 0xA937A3: (within /usr/lib/libdbus-glib-1.so.2.1.0)<br>==6969== &nbsp; &nbsp;by 0x3B8569: g_value_copy (gvalue.c:119)<br>==6969== &nbsp; &nbsp;by 0x3B8B3B: g_value_array_insert (
gvaluearray.c:177)<br>==6969== &nbsp; &nbsp;by 0x3B8C5D: g_value_array_append (gvaluearray.c:153)<br>==6969== &nbsp; &nbsp;by 0xDEF822: notify_notification_set_icon_from_pixbuf<br>(notification.c:894)<br><br>as well as a number of other of instances of &quot;still reachable in loss
<br>record&quot; ...<br><br>So my question is: what happens when the notification &quot;times out&quot;. Is it<br>destroyed ?<br><br>Same question when you click on teh notification to dismiss it.<br><br>Are there any objects that are put into the notification that need to be
<br>&quot;unref&quot;&#39;ed ?<br><br>Thank you, and best rgds,<br><br>- -Greg<br><br>- --<br>+---------------------------------------------------------------------+<br><br>Please also check the log file at &quot;/dev/null&quot; for additional information.
<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(from /var/log/Xorg.setup.log)<br><br>| Greg Hosler &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="mailto:ghosler@redhat.com">ghosler@redhat.com</a> &nbsp; &nbsp;|<br>+---------------------------------------------------------------------+
<br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.4.7 (GNU/Linux)<br>Comment: Using GnuPG with Fedora - <a href="http://enigmail.mozdev.org" target="_blank">http://enigmail.mozdev.org</a><br><br>iD8DBQFHafCB404fl/0CV/QRArumAJ9XyGqeDmCBmlXKExV5h/ev138T+ACcDIO3
<br>+llrVQ8mJ1rnDv3czlp/z9g=<br>=F4Te<br>-----END PGP SIGNATURE-----<br>_______________________________________________<br>galago-devel mailing list<br><a href="mailto:galago-devel@lists.freedesktop.org">galago-devel@lists.freedesktop.org
</a><br><a href="http://lists.freedesktop.org/mailman/listinfo/galago-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/galago-devel</a><br></blockquote></div><br><br clear="all"><br>-- <br>Christian Hammond - 
<a href="mailto:chipx86@chipx86.com">chipx86@chipx86.com</a><br>VMware, Inc.