Pixmap deallocation weirdness



This kind of goes along with what I was asking about before with the
segfault I was getting.  I'm wondering if I have to do something special
where I'm defining the background pixmap for all states during window
destruction?

Some relevant pieces of code:

Struct definition
--
struct widget_struct
{
    GtkWidget *win;
    GtkWidget *table;
    GtkWidget *prog_bar;
    GdkPixmap *pixmap;
    GtkStyle *sty;
    guint width;
    guint height;
};

struct widget_struct *s;


Window setup (s->pixmap already points to a valid pixmap)
--
s->win = gtk_window_new( GTK_WINDOW_DIALOG );
gtk_window_set_modal( GTK_WINDOW( s->win ), TRUE );

s->sty = gtk_style_copy( gtk_widget_get_style( s->win ) );

for( i = 0; i < 5; i++ )
    s->sty->bg_pixmap[i] = s->pixmap;
gtk_widget_set_style( s->win, s->sty );


Window destroy
--
gtk_widget_hide_all( s->win );
gtk_object_destroy( GTK_OBJECT( s->win ) );
s->win = NULL;
s->table = NULL;
s->prog_bar = NULL;
s->sty = NULL;
s->pixmap = NULL;

free( s );

The odd thing is that when I call gtk_object_destroy, I get a lot of
warnings that all say:

Gdk-CRITICAL **: file gdkpixmap.c: line 823 (gdk_pixmap_unref):
assertion `private->ref_count > 0' failed.

Do I need to destroy the pixmap with a gdk_pixmap unref and set the
window style back to "blank" background pixmaps on the window before I
destroy it?

--
"IRS: We've got what it takes to take what you've got!"

Cole Tuininga
Network Admin
Code Energy, Inc
Egon code-energy com
(603) 766-2208




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