colormap problems



Hey,

I think this is probably something that's been covered before, but I
thought I did the right thing, and it's not working:

The code I have had been working fine in gtkmm-2.2.9, but is not working
with gtkmm-2.4.7

Essentially, I load a glade file, grab the main window, show_all() on
the main window, then go on to grab visual and colormap info, like so
(although many details are omitted for brevity):


void GtkWindowMgr::_InitMain()
{
    //....
    // Now initialize the windows
    _glade = Gnome::Glade::Xml::create("./glade/orion/orion.glade", "window");

    _glade->get_widget("window", _mw);

    // THIS SIGNAL NEVER ACTUALLY GETS CALLED ?? because of glade?
    // so trying to delay till the window is up isn't working
    _mw->signal_realize().
        connect(sigc::mem_fun(*this, &GtkWindowMgr::_FinishInit));

//     mw->set_default_size(1200, 1000);
    _mw->resize(1200, 950);
    _mw->show_all();
    // ....
}

void GtkWindowMgr::_FinishInit()
{
   // ....
    Glib::RefPtr<Gdk::Visual> best = 
//         Gdk::Visual::get_best(24, Gdk::VISUAL_TRUE_COLOR);
        Gdk::Visual::get_best(Gdk::VISUAL_TRUE_COLOR);

    dbg[0] << "Got visual" << endl;
    Glib::RefPtr<Gdk::Screen> scr = best->get_screen();

    dbg[0] << "Got screen" << endl;
    _cmap = scr->get_default_colormap();

    dbg[0] << "Got cmap" << endl;
    _colorMgr = new GtkColorMgr(_cmap);

    // ...
}


I get these errors:  The first is caused by the
Glib::RefPtr<Gdk::Screen> going out of scope.  The other I have no clue
about.  And like I said, this code was working fine in gtkmm-2.2.9

(metlab.Linux:28195): GLib-GObject-CRITICAL **: file gobject.c: line
1579 (g_object_unref): assertion `G_IS_OBJECT (object)' failed

Gdk-ERROR **: A GdkVisual object was finalized. This should not happen
aborting...


[root traveler i386]# rpm -qa "*gtkmm*"
gtkmm24-docs-2.4.7-1
gtkmm24-devel-2.4.7-1
gtkmm2-2.2.9-1.1.fc1.fr
gtkmm2-devel-2.2.9-1.1.fc1.fr
gtkmm24-2.4.7-1


Any clues?


-- 
Carl Nygard <cjnygard fast net>




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