After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 343638 - Tiny memleak from gtkfilechooserdefault
Tiny memleak from gtkfilechooserdefault
Status: RESOLVED DUPLICATE of bug 348113
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.9.x
Other All
: Normal minor
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2006-06-01 23:16 UTC by Chris Wilson
Modified: 2006-07-20 11:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Missing gtk_file_system_volume_free (682 bytes, patch)
2006-06-01 23:17 UTC, Chris Wilson
none Details | Review
Add g_object_unref(handle) (520 bytes, patch)
2006-06-01 23:43 UTC, Chris Wilson
none Details | Review
Call g_object_unref after gtk_file_system_cancel_operation (6.79 KB, patch)
2006-06-02 06:58 UTC, Chris Wilson
none Details | Review
Again, without the erroneous volume_free (6.71 KB, patch)
2006-06-02 07:00 UTC, Chris Wilson
none Details | Review

Description Chris Wilson 2006-06-01 23:16:09 UTC
Missing free for system volume inside shortcuts_add_current_folder.
Comment 1 Chris Wilson 2006-06-01 23:17:34 UTC
Created attachment 66629 [details] [review]
Missing gtk_file_system_volume_free
Comment 2 Chris Wilson 2006-06-01 23:40:57 UTC
On closer inspection, that is not the right fix since the volume is actually put into the shortcuts_models, AIUI...

Anyway, valgrind definitely thinks it's lost...
==19569== 2 bytes in 1 blocks are definitely lost in loss record 23 of 14,955
==19569==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==19569==    by 0x4537AF5: g_malloc (gmem.c:131)
==19569==    by 0x454ADC8: g_strdup (gstrfuncs.c:91)
==19569==    by 0x5AD8EDF: (within /usr/lib/libgtk-x11-2.0.so.0.901.0)
==19569==    by 0x59341E3: gtk_file_system_get_volume_for_path (in /usr/lib/libgtk-x11-2.0.so.0.901.0)
==19569==    by 0x591B654: (within /usr/lib/libgtk-x11-2.0.so.0.901.0)
==19569==    by 0x5ADAC3D: (within /usr/lib/libgtk-x11-2.0.so.0.901.0)
==19569==    by 0x452E8E0: g_idle_dispatch (gmain.c:3909)
==19569==    by 0x4530651: g_main_context_dispatch (gmain.c:2028)
==19569==    by 0x453361E: g_main_context_iterate (gmain.c:2660)
==19569==    by 0x45339C8: g_main_loop_run (gmain.c:2864)
==19569==    by 0x5986423: gtk_main (in /usr/lib/libgtk-x11-2.0.so.0.901.0)

Not to mention the leak of handles from gtk_file_system_get_info...
==19569== 1,200 bytes in 60 blocks are definitely lost in loss record 14,774 of 14,955
==19569==    at 0x40051F9: malloc (vg_replace_malloc.c:149)
==19569==    by 0x4537AF5: g_malloc (gmem.c:131)
==19569==    by 0x45477E7: g_slice_alloc (gslice.c:783)
==19569==    by 0x4547B47: g_slice_alloc0 (gslice.c:792)
==19569==    by 0x44F0099: g_type_create_instance (gtype.c:1547)
==19569==    by 0x44D6631: g_object_constructor (gobject.c:1015)
==19569==    by 0x44D49D9: g_object_newv (gobject.c:912)
==19569==    by 0x44D54DE: g_object_new_valist (gobject.c:955)
==19569==    by 0x44D568F: g_object_new (gobject.c:793)
==19569==    by 0x5ADAA3D: (within /usr/lib/libgtk-x11-2.0.so.0.901.0)
==19569==    by 0x5ADB568: (within /usr/lib/libgtk-x11-2.0.so.0.901.0)
==19569==    by 0x59343EF: gtk_file_system_get_info (in /usr/lib/libgtk-x11-2.0.so.0.901.0)
which may well just be the unexecuted callbacks? But I suspect not, as inside shortcuts_insert_path: 
handle = gtk_file_system_get_info()
...
gtk_list_store_set(impl->shortcuts_model, &iter,
  SHORTCUTS_COL_HANDLE, handle,
  -1);
<no g_object_unref(handle);>
return;
where the column type for SHORTCUTS_COL_HANDLE is G_TYPE_OBJECT hence the store acquires its own reference and we do not release ours.


Comment 3 Chris Wilson 2006-06-01 23:43:28 UTC
Created attachment 66630 [details] [review]
Add g_object_unref(handle)
Comment 4 Chris Wilson 2006-06-02 06:48:13 UTC
I suspect that there are many more handle leaks inside gtkfilechooserdefault...

For example:
impl->file_list_drag_data_received_handle and co are assumed to be unref'ed by gtk_file_system_cancel_operation, which it doesn't.

And reading the code again reveals shortcut_free_row_data which is meant to close the leaks I mentioned earlier...
Comment 5 Chris Wilson 2006-06-02 06:58:19 UTC
Created attachment 66647 [details] [review]
Call g_object_unref after gtk_file_system_cancel_operation

Am I getting closer? I still think the reference handling through the list store is confused and needs closer inspection - actually all the g_object_unref needs careful review by someone who actually understands the code...
Comment 6 Chris Wilson 2006-06-02 07:00:22 UTC
Created attachment 66648 [details] [review]
Again, without the erroneous volume_free
Comment 7 Chris Wilson 2006-07-20 11:11:53 UTC

*** This bug has been marked as a duplicate of 348113 ***