[9744] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Memory management

daemon@ATHENA.MIT.EDU (Jeremy Wise)
Sun Nov 1 20:23:19 1998

Date: Sun, 1 Nov 1998 20:22:50 -0500 (EST)
From: Jeremy Wise <jwise@pathwaynet.com>
To: gtk-list@redhat.com
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com


I've come across a memory leak in my program (gtkicq), and it appears to
have something to do with styles.  Here's the situation.  When in chat,
and the user hits a character, a callback is called which sends the key to
the other client, and sets the style...

GtkStyle *style;
.
.
.
style = gtk_style_new();
memcpy( &style->fg[ GTK_STATE_NORMAL ], foreground, sizeof(GdkColor) );
memcpy( &style->text[ GTK_STATE_NORMAL ], foreground, sizeof(GdkColor) );
memcpy( &style->base[ GTK_STATE_NORMAL ], background, sizeof(GdkColor) );

gtk_widget_set_style( widget, style );
.
.
.

where widget is the text widget the user is typing in.  My question is, do
I have to clean up that style, or the colors after setting the style, or
should I leave them alone?  If the latter, then why is this "leaking?"

Any help will be appreciated.

Sincerely,

Jeremy Wise

+----------------------------------------------------------------+
| Jeremy Wise                                God rules.          |
| jwise@pathwaynet.com                       Always has,         |
| ICQ #4664755                               Always will.        |
| http://www.pathwaynet.com/~jwise           Hope you know Him!  |
+----------------------------------------------------------------+

-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post