Re: libglademm core dumps with older glade files



On Thu, 2005-02-24 at 16:04 -0500, Carl Nygard wrote:
> On Thu, 2005-02-24 at 14:13 -0500, Carl Nygard wrote:
> > On Thu, 2005-02-24 at 19:09 +0100, Murray Cumming wrote:
> > > On Thu, 2005-02-24 at 13:03 -0500, Carl Nygard wrote:
> > > > On Thu, 2005-02-24 at 11:06 +0100, Murray Cumming wrote:
> > > > 
> > > > Where do I use --g-fatal-warnings?
> > > 
> > > In gdb, use "run --g-fatal-warnings" instead of "run". It's a command-
> > > line argument that all GTK+-based applications can take.
> 
> Here's a simple program to produce core files.

Greatly simplified.  Turns out:

GtkWindow* win;

win->get_screen()->get_system_visual()->get_screen()
  does not yield the same behavior as
win->get_screen();

Not only that, but using the Visual to get the screen seems to cause
some internal gtk stuff to get reset (generate a stack trace to see).

#0  0x005a87a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) where
#0  0x005a87a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x00c4a955 in raise () from /lib/tls/libc.so.6
#2  0x00c4c319 in abort () from /lib/tls/libc.so.6
#3  0x00484f7e in g_logv () from /usr/lib/libglib-2.0.so.0
#4  0x00484fb0 in g_log () from /usr/lib/libglib-2.0.so.0
#5  0x00428885 in g_object_unref () from /usr/lib/libgobject-2.0.so.0
#6  0x003c1a0f in gdk_screen_set_default_colormap ()
   from /usr/lib/libgdk-x11-2.0.so.0
#7  0x004288dc in g_object_unref () from /usr/lib/libgobject-2.0.so.0
#8  0x006785be in Glib::ObjectBase::unreference ()
   from /usr/lib/libglibmm-2.4.so.1
#9  0x08049599 in ~RefPtr (this=0xbffed5c0) at refptr.h:169
#10 0x08049368 in main (argc=2, argv=0xbffed694) at test.cxx:43


-- 
Carl Nygard <cjnygard fast net>
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <gdkmm/colormap.h>
#include <libglademm/xml.h>

#include <iostream>
#include <string>

using Gtk::manage;


void Realized()
{
    std::cout << "Realized" << std::endl;
}

int main(int argc, char** argv)
{
    Gtk::Main m(argc, argv);

    bool doColor = ((argc > 1) &&  strcmp("color",argv[1]) == 0);

    Gtk::Window* mw = new Gtk::Window();

//     mw->signal_realize().connect(sigc::ptr_fun(&Realized));
//     mw->resize(1000, 900);
    mw->show_all();

    Glib::RefPtr<Gdk::Visual> best = mw->get_screen()->get_system_visual();
    if(!best){
        std::cout << "Unable to get_system_visual" << std::endl;
        exit(0);
    }
    std::cout << "Got visual: " << (void*)best.operator->() << std::endl;
    if(doColor){
        std::cout << "This will core dump" << std::endl;
        Glib::RefPtr<Gdk::Screen> scr = best->get_screen();
        if(!scr){
            std::cout << "Unable to get_screen" << std::endl;
            exit(0);
        }
        std::cout << "Got screen: "<<(void*)scr.operator->() << std::endl;
    }else{
        Glib::RefPtr<Gdk::Screen> scr = mw->get_screen();
        if(!scr){
            std::cout << "Unable to get_screen" << std::endl;
            exit(0);
        }
        std::cout << "Got screen: "<<(void*)scr.operator->() << std::endl;
    }
    std::cout << "outer" << std::endl;


    Gtk::Main::run();
}


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