help with coding, pixmaps



I've been really at a loss to find what seems like a memory leak.
Actually, it seems to locate itsself around code which I SWEAR has to be
right but maybe not I can't find the error here is the volitile code:

    GdkPixmap *play_pix[4];    
    GdkBitmap *play_mask[4];
    GtkStyle *style;        
 
    gtk_widget_realize(mother->main_window);
    style = gtk_widget_get_style(mother->main_window);

    ptr = -1;
    play_pix[++ptr] = gdk_pixmap_create_from_xpm_d(
            mother->main_window->window, &play_mask[ptr],
            &style->bg[GTK_STATE_NORMAL],
            play0_xpm);
    play_pix[++ptr] = gdk_pixmap_create_from_xpm_d(
            mother->main_window->window, &play_mask[ptr],
            &style->bg[GTK_STATE_NORMAL],
            play1_xpm);
    play_pix[++ptr] = gdk_pixmap_create_from_xpm_d(
            mother->main_window->window, &play_mask[ptr],
            &style->bg[GTK_STATE_NORMAL],
            play2_xpm);
    play_pix[++ptr] = gdk_pixmap_create_from_xpm_d(
            mother->main_window->window, &play_mask[ptr],
            &style->bg[GTK_STATE_NORMAL],
            play3_xpm);                                                

    for(ptr = 0; ptr < 4; ptr ++) {
        gdk_pixmap_unref (play_pix[ptr]);       
        gdk_bitmap_unref (play_mask[ptr]);    /* CRASH CRASH CRASH */       
    }

Is the gtk_widget_realize even necessary? What is it anyways? I added it
in later thinking it might stop the crashing... the error seems to always
happen when trying 'gdk_bitmap_unref(play_mask[ptr])'. I have 2 linked
lists but I've checked every line of this code a few times. I have no idea
where the error might be. Please help me to confirm whether this code is
wrong or not so I that I might look elsewhere.


Travis Loyd
[email: lelandg@usa.net				Encrypt your email too: ]
[ (* GNU Privacy Guard, make the switch today! *)  http://www.gnupg.org	]
[  pgp: send email with subject: sendmepgp	or http://www.pgp.com	]



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