Re: a couple of Gnome2::Canvas problems




On Jul 11, 2005, at 12:58 PM, zentara wrote:

I'm trying to make a simple gauge with the Gnome2::Canvas.
It all works well, except when I destroy the meter.  I get an error

nomeCanvas-CRITICAL **: file gnome-canvas.c: line 3698 (gnome_canvas_request_redraw): assertion `GNOME_IS_CANVAS (canvas)' failed during global destruction.

I tried your script with stock FC2 (libgnomecanvas 2.6.0) and with a gnome CVS HEAD sandbox (libgnomecanvas 2.11.1).

With 2.6 i see your shutdown error, and with 2.11 i do not. Looks like there were some related bugs:

http://bugzilla.gnome.org/show_bug.cgi?id=90259
http://bugzilla.gnome.org/show_bug.cgi?id=99689
http://bugzilla.gnome.org/show_bug.cgi?id=304915

In no cases do i see the error from $text->set().

One problem is that your items are outliving your canvas. I see this as a design issue with the canvas --- the items and canvas have a circular relationship, and you have to keep your own pointers to the items because there's not way to fetch them from the canvas. This means you have your own perl references to the canvas items, and the perl references will keep the items artificially alive after the canvas has been destroyed. Bugs in the finalization process of the canvas allow it to attempt a screen redraw during destruction, and you get either an assertion or a segfault, depending on the state of the dead pointers.

Simple solution -- clear your own item references just before destroying the canvas.


###########################################################3
sub delete_event {

    # clear our item references, so things can die in peace.
    $text = undef;
    $box = undef;
    $hub = undef;
    $gauge = undef;
    $floor = undef;
    $needle = undef;

    $watch->Unwatch;
    $canvas->destroy;
    Gtk2->main_quit;
    return 0;
}


--
Without treatment, a common cold will last about seven days.
With treatment, it will last about a week.
  -- conventional wisdom




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