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 374094 - Freeing Gtk owned memory in Gtk::Style::lookup_icon_set
Freeing Gtk owned memory in Gtk::Style::lookup_icon_set
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal critical
: ---
Assigned To: Stef Walter
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2006-11-12 00:21 UTC by Stef Walter
Modified: 2006-11-23 14:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch which fixes lookup_icon_set (1.39 KB, patch)
2006-11-12 00:21 UTC, Stef Walter
none Details | Review
Test case for bug and patch. (704 bytes, text/plain)
2006-11-12 00:22 UTC, Stef Walter
  Details

Description Stef Walter 2006-11-12 00:21:10 UTC
Gtk::Style::lookup_icon_set returns a Gtk::IconSet which doesn't copy the internal GtkIconSet object. This results in freeing Gtk's internal copy of the icon set.

A second call to Style::lookup_icon_set for the same icon will crash, hang etc...

BUG occurs:
IconSet set = style->lookup_icon_set(STOCK_APPLICATION); 

WORKAROUND:
GtkIconSet* gset = gtk_style_lookup_icon_set(style->gobj(), 				                              STOCK_APPLICATION.get_string().c_str());
IconSet set(gset, true);

Will attach a patch.
Comment 1 Stef Walter 2006-11-12 00:21:43 UTC
Created attachment 76410 [details] [review]
Patch which fixes lookup_icon_set
Comment 2 Stef Walter 2006-11-12 00:22:33 UTC
Created attachment 76411 [details]
Test case for bug and patch.
Comment 3 Murray Cumming 2006-11-13 08:21:40 UTC
Using the refreturn optional parameter for _WRAP_METHOD() is probably the simpler fix.
Comment 4 Stef Walter 2006-11-14 03:17:42 UTC
IconSet has neither reference() nor operator bool().  Should those methods be added?
Comment 5 Murray Cumming 2006-11-23 14:48:12 UTC
Ah, now I understand. You are saying that the refreturn parameter can't work, because there is no reference() function. OK. Comitted. Thanks.