[9752] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: Memory management
daemon@ATHENA.MIT.EDU (Eric Harlow)
Mon Nov 2 08:22:25 1998
Date: Mon, 2 Nov 1998 05:23:30 -0800 (PST)
From: Eric Harlow <linuxgeek@yahoo.com>
To: gtk-list@redhat.com
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
Based on last weeks discussion about references, it seems that you'll
have to do a gtk_style_unref after the style has been assigned to the
widget so that it gets freed when the widget no longer uses it.
-Eric
---Jeremy Wise <jwise@pathwaynet.com> wrote:
>
>
> 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
>
>
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null