Memory management




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!  |
+----------------------------------------------------------------+



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