Re: colormap assertion errors



Murray Cumming wrote:
On Mon, 2004-11-29 at 21:54 -0600, Rob Benton wrote:

I've narrowed down the error to one variable, the Gdk::Colormap. That's what's failing the assertion with:

-ERRORS---------------------------------------------------------
(chip:3201): GLib-GObject-CRITICAL **: file gobject.c: line 1579 (g_object_unref): assertion `G_IS_OBJECT (object)' failed (chip:3201): Gdk-CRITICAL **: file gdkcolor-x11.c: line 690 (gdk_colormap_free_colors): assertion `GDK_IS_COLORMAP (colormap)' failed
----------------------------------------------------------------

I'm declaring a Gtk::DrawingArea member variable on the stack and a Glib::RefPtr<Gdk::Colormap> member variable. Then I'm using this line inside the class' constructor:

-CODE-----------------------------------------------------------
_colormap = _drawarea.get_default_colormap();
----------------------------------------------------------------


I have discovered a bug in Gtk::Widget::get_default_colormap(). It needs
a "refreturn" in the .hg file. I'll fix that.

As a workaround for now, you should be able to using
Gdk::Screen::get_default()->get_default_colormap(). However, you need at
least gtkmm 2.4.6, because Screen::get_default() used to have the same
problem.

By the way, Gtk::Widget::get_default_colormap() is a static function, so
you don't need the _drawarea instance in order to call it.

Cool, thanks. It works. It seemed like free_colors() was getting called on the destruction of the Gdk::Colormap object. Should I be calling Gdk::Colormap::free_colors() explicitly? The 2.4 tutorial doesn't mention it.




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