Re: Using g_object_get_data() in a NautilusMenuItem callback



It turns out that I wasn't using files->data and that's what was causing the problem. I added a g_object_unref (files->data) to the code, but I'm not sure if it's necessary. What happens to the other menu items that are not activated in the context menu...nautilus_file_info_copy () does a g_object_ref () on each of the data parameters of the GList. If the user doesn't select the context menu item, are those references automatically cleaned up somehow?

Boyd

On Nov 11, 2004, at 5:31 PM, Joe Shaw wrote:

On Thu, 2004-11-11 at 16:19 -0700, Boyd Timothy wrote:
Could someone let me know if this is the right way to use
g_object_get_data() in my callback function in my NautilusMenuItem
implementation? Something I'm doing isn't working quite right and it's
causing Nautilus to crash when I select this item from the context
menu.

Presumably you're using g_object_set_data (item, "files", file); at some
point to set it.  If it's a GObject then there's a decent chance that
it's being freed.  Call g_object_ref () on it when you set it, and
remember to g_object_unref() it when you're finished with it.

Joe





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]