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 432386 - GtkFileChooserDefault leaks memory if a shortcut cannot be found
GtkFileChooserDefault leaks memory if a shortcut cannot be found
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.10.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2007-04-22 20:48 UTC by Tilman Sauerbeck
Modified: 2013-05-30 15:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (502 bytes, patch)
2007-04-22 20:51 UTC, Tilman Sauerbeck
none Details | Review

Description Tilman Sauerbeck 2007-04-22 20:48:32 UTC
Please describe the problem:
GtkFileChooserDefault tries to add two shortcuts by default:
 * /home/foo and
 * /home/foo/Desktop

If these don't exist on the system, the respective row is removed from the list store, but the data in the list store entry isn't freed.
 

Steps to reproduce:
1. rmdir ~/Desktop
2. GtkWidget w = gtk_file_chooser_dialog_new(..., GTK_FILE_CHOOSER_ACTION_OPEN, ...);
3. gtk_widget_destroy (w);


Actual results:
A gtk_file_path() instance is leaked.

Expected results:
No leak happens.

Does this happen every time?
Yes.

Other information:
When we remove the shortcut from the list store, we need to call shortcuts_free_row_data() on the entry. I think.
Comment 1 Tilman Sauerbeck 2007-04-22 20:51:29 UTC
Created attachment 86799 [details] [review]
Patch

This patch is against 2.10.11. It works for me and looks correct, but it might not be the best way.
Comment 2 Matthias Clasen 2007-04-25 18:54:59 UTC
Hmm, it is possible that you are correct, but I don't see the leak in quick valgrind testing. How did you notice the leak ?
Comment 3 Tilman Sauerbeck 2007-04-25 19:46:17 UTC
By running Valgrind :)

Did you try to rmdir ~/Desktop? I'm pretty sure that should trigger it reliably.
Comment 4 Matthias Clasen 2007-04-25 19:58:59 UTC
Yes, I moved my ~/Desktop away
Comment 5 Tilman Sauerbeck 2007-04-25 20:12:39 UTC
Strange. Does Valgrind complain about double-frees if you run with the patch applied?
Comment 6 Timothy Arceri 2013-05-28 22:34:31 UTC
Should this be marked as obsolete? I can't even see where the old patch should be applied. Looks like things have changed a lot since.
Comment 7 Federico Mena Quintero 2013-05-30 15:32:18 UTC
Great catch!  This is certainly valid for the gtk-2-24 branch.

I've pushed your patch as commit 3b82c12 in that branch.

This bug totally slipped by my inbox; sorry that I let it lay dormant for years.