Should a g_object_new have a matching g_object_unref?
Posted
by legends2k
on Stack Overflow
See other posts from Stack Overflow
or by legends2k
Published on 2010-05-17T10:30:00Z
Indexed on
2010/05/17
10:40 UTC
Read the original article
Hit count: 269
I'm using libnotify to show desktop notifications in my application; notify_notification_new()
returns a NotifyNotification*
, which should be passed as the first param to further function calls of the notification library.
There is no notify_notification_free()
which frees the pointer it returns. I looked up the source of notify_notification_new()
and internally it does a g_object_new()
, gets a GObject* and returns it as a NotfiyNotification*
, so when my application does the clean up, should I call a g_object_unref()
on the pointer returned by notify_notification_new()
?
© Stack Overflow or respective owner