GNOME Bugzilla – Bug 107686
CanvasAA destructor (mem dealloc) bug
Last modified: 2004-12-22 21:47:04 UTC
as opposed to the destructor of Gnome::Canvas::Canvas which works fine, there seems to be a mem or destructor problem with the Gnome::Canvas::CanvasAA just take the standard example file from gtkmm: gnomemm-all-1.3.15/libgnomecanvasmm/examples/canvas/canvas.cc and modify line 8 class CanvasExample : public Gnome::Canvas::CanvasAA instead of class CanvasExample : public Gnome::Canvas::Canvas then the program executes fine wit an AA canvas. however, when closing the program, the following errors appear: $ ./canvas (canvas:27026): GLib-GObject-WARNING **: instance of invalid non-instantiatable type `<invalid>' (canvas:27026): GLib-GObject-CRITICAL **: file gsignal.c: line 2490 (g_signal_emit_valist): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed (canvas:27026): GLib-GObject-CRITICAL **: file gobject.c: line 1337 (g_object_unref): assertion `G_IS_OBJECT (object)' failed i detected this error on another program (the gtkmm canvas example is just for illustration) and since that program worked without err in c, i suppose there is a destructor error in the CanvasAA wrapper in my original program, closing the program (which executes and displays fine even with CanvasAA) gives the following error: (gaga:20503): GnomeCanvas-CRITICAL **: file gnome-canvas.c: line 3721 (gnome_canvas_request_redraw): assertion `GNOME_IS_CANVAS (canvas)' failed this error message is repeated for each Canvas::Item that was displayed before closing the program just as the gnomemm-all-1.3.15/libgnomecanvasmm/examples/canvas/canvas.cc file, replacing Gnome::Canvas with Gnome::CanvasAA leads to a working program that displays perfectly but with CanvasAA there are errors when the program is closed conclusion: destructor problem in the Gnome::CanvasAA wrapper
Maybe it's something to do with this mysterious code in the constructor: http://cvs.gnome.org/lxr/source/gnomemm/libgnomecanvasmm/libgnomecanvas/src/canvas.ccg#49
It might help to have an example in C that works. Then we could compare what the C example does and what libgnomecanvasmm does.
Could you try to write that C test case?
Created attachment 18477 [details] valgrind.txt
Here's the valgrind output, by the way. (valgrind.txt). The gap in the middle is between startup and shutdown of the app.
Created attachment 18478 [details] gfatalwarnings_backtrace.txt
And gfatalwarnings_backtrace.txt is a backtrace when running the program with --g-fatal-warnings.
Sorry for the delay, and thanks for finding this. 2003-07-21 Murray Cumming <murrayc@usa.net> * libgnomecanvas/src/canvas.hg: Use the new GMMPROC_PROTECTED_GCLASS macro on the Canvas class so that the CanvasAA class can access canvas_class_. * libgnomecanvas/src/canvas.ccg: Rewrite the CanvasAA constructor to use the new (and working) gtkmm2-style construction construction. Fixes bug #107686. * configure.in: Now requires gtkmm 2.2.5, which has the new macro.