gtkdatabox : pixmap and segfaults

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

 



Hi there,

I am currently maintaining gtkdatabox. It is a nice data plotting package which is tightly integrated with GTK.

I am having problems with the 'realize' GTK function.
When a previously 'unrealize' pixmap is addressed, I get seg fault.

The chain flow goes like this :

Add a reference to the widget the pack in a container.
Remove the widget from a container.
(it gets unrealized)
Pack the widget back into the container.
(the realize function is called and in this function it dies)

It dies when calling the 'gdk_pixmap_get_size' function as the pixmap appears not to be valid.
I can't work out how to check whether the pixmap is valid before I call this function.

the code can be obtained from here :
http://sourceforge.net/projects/gtkdatabox/

the offending code is in the file gtkdatabox_ruler.c  :

static void
gtk_databox_ruler_make_pixmap (GtkDataboxRuler * ruler)
{
    GtkWidget *widget;
    gint width;
    gint height;

    widget = GTK_WIDGET (ruler);

    if (ruler->priv->backing_pixmap)
    {
        gdk_pixmap_get_size (ruler->priv->backing_pixmap, &width, &height);
        if ((width == widget->allocation.width) &&
                (height == widget->allocation.height))
            return;

        g_object_unref (ruler->priv->backing_pixmap);
    }

    ruler->priv->backing_pixmap = gdk_pixmap_new (widget->window,
                                  widget->allocation.width,
                                  widget->allocation.height, -1);

    ruler->priv->xsrc = 0;
    ruler->priv->ysrc = 0;
}

thanks
Matt
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux