Hi everyone, I've got a problem with get_window().. gdb backtrace shows me that a segfault is caused by this function returning NULL from inside a member of my SubnetRenderer class, which is derived from Gtk::Drawable. here's the function that generates the problem: void SubnetRenderer::setStatus(int s) { Gdk::Cursor ar(Gdk::ARROW); Gdk::Cursor ch(Gdk::CROSSHAIR); // Non funge, non capisco perché.. Glib::RefPtr<Gdk::Window> w = get_window(); std::cout << "Sono qui! :)\n"; Gdk::Color c("black"); //gc->set_foreground(mainColor); if(w == NULL) std::cout << "E' NULL!!!\n"; w->set_cursor(ar); switch(s) { case DEFAULT: sb_text = "Selezionare un oggetto per informazioni"; break; case ADD_HOST: cleanSelections(); sb_text = "Cliccare su un punto della mappa per aggiungere un host."; break; case ADD_ROUTER: cleanSelections(); //get_window()->set_cursor(ch); sb_text = "Cliccare su un punto della mappa per aggiungere un router."; break; case SOMETHING_IS_SELECTED: sb_text = selected->getInfo(); break; default: sb_text = "Questo stato è impossibile. Come direbbe Nunnari: \"Sei un PIIIIRLA\""; break; } status = s; } and here's the backtrace [...] (gdb) run Starting program: /home/andrea/Uni/Reti di Calcolatori/simulatore_reti/ Sim Sono qui! :) E' NULL!!! Program received signal SIGSEGV, Segmentation fault. Gdk::Window::set_cursor(Gdk::Cursor const&) (this=0x0, cursor= 0xbffff110) at window.h:719 719 window.h: No such file or directory. in window.h (gdb) bt #0 Gdk::Window::set_cursor(Gdk::Cursor const&) (this=0x0, cursor= 0xbffff110) at window.h:719 #1 0x08094f6d in SubnetRenderer::setStatus(int) (this=0xbffff4a0, s=0) at SubnetRenderer.cpp:178 #2 0x08093f5a in SubnetRenderer (this=0xbffff4a0, xsize=700, ysize=600, dwb=0x0, ldwb=0x0) at SubnetRenderer.cpp:40 #3 0x08099ee6 in TestWindow (this=0xbffff490) at TestWindow.cpp:25 #4 0x080a1705 in main (argc=1, argv=0xbffff854) at Tester.cpp:8 #5 0x4093e469 in __libc_start_main () from /lib/libc.so.6 (gdb) PLEASE HELP ME!! I'm going MAD!! thanks in advance!! -- [ Andrea Spadaccini - a.k.a. Lupino/Lupin85 - Catania - ICQ#: 91528290 ] [ GPG ID: 5D41ABF0 - key @ pgp.mit.edu - Slackware 10.1 w/Linux 2.4.22 ] [ Linux User # 313388 - MAIL: a.spadaccini(at)catania(dot)linux(dot)it ] [ Penguins like this song: <Sconosciuto> - Coldplay - 10 - Everythings ]
Attachment:
pgpF50201WZaa.pgp
Description: PGP signature