Re: Gtk::Menu with libglademm



Am Sun, 7 Mar 2010 01:44:51 +0200 schrieb Michael:

> Hello,
> > I rewrote my code to use Gtk::Builder::create_from_file() logic,
> > but as result I get:
> >
> > BuilderError: Invalid root element: 'glade-interface'
> This is probably, because your files is actually in glade format,
> rather than Builder.

I used another system with Glade 3.6.3 installed...

> > My glade file starts like this:
> >
> > <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> > <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
> And this doctype shows it quite clearly.
> 
> > Any ideas about that problem?
> 
> Actually, you should try to load your file back in glade and save it
> as GtkBuilder. Just select
> Save As... and in the dialog box, in the bottom left corner you will
> notice 2 radoibuttons.
> One says GtkBuilder, and the other Libglade. You need GtkBuilder.
> Overwrite your file,

...and just converted my Glade to a GtkBuilder file.

> and try running your program again. If it doesn't work, then there's
> something rather obscure there.

I think it's really obscure. See the gdb backtrace I get:

Starting program: /mnt/raid/home/andreas/src/svn/state/trunk/src/state 
[Thread debugging using libthread_db enabled]
[New Thread 0xb6dd4720 (LWP 10040)]

(state:10040): gtkmm-CRITICAL **: gtkmm: object `umlEditMenu' not found in GtkBuilder file.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6dd4720 (LWP 10040)]
0xb7ded505 in Gtk::Builder::get_widget_checked () from /usr/lib/libgtkmm-2.4.so.1
(gdb) bt
#0  0xb7ded505 in Gtk::Builder::get_widget_checked () from /usr/lib/libgtkmm-2.4.so.1
#1  0x08051a2a in Gtk::Builder::get_widget<Gtk::Menu> (this=0x9c84550, name= 0xbf99d12c, widget= 0x9c844e0)
    at /usr/include/gtkmm-2.4/gtkmm/builder.h:474
#2  0x0804fed0 in UMLDrawer::getGladeWidgets (this=0x9c844b8) at UMLDrawer.cpp:40
#3  0x08050766 in UMLDrawer (this=0x9c844b8, cobject=0x9c60c88, refGlade= 0xbf99d1a4) at UMLDrawer.cpp:28
#4  0x08052d02 in Gtk::Builder::get_widget_derived<UMLDrawer> (this=0x9c84550, name= 0xbf99d1ec, 
    widget= 0x9db1920) at /usr/include/gtkmm-2.4/gtkmm/builder.h:532
#5  0x08051dbe in Application::getGladeWidgets (this=0x9db1908) at Application.cpp:42
#6  0x08052496 in Application (this=0x9db1908, cobject=0x9c93038, refGlade= 0xbf99d274) at Application.cpp:24
#7  0x0804f0ac in Gtk::Builder::get_widget_derived<Application> (this=0x9c84550, name= 0xbf99d2cc, 
    widget= 0xbf99d2d0) at /usr/include/gtkmm-2.4/gtkmm/builder.h:532
#8  0x0804ed6b in create_gtk_window (argc=1, argv=0xbf99d3b4) at main.cpp:44
#9  0x0804ee47 in main (argc=Cannot access memory at address 0x0

I uploaded the relevant files here:

http://tux-style.com/tmp/UMLDrawer.cpp
http://tux-style.com/tmp/UMLDrawer.h
http://tux-style.com/tmp/main.cpp
http://tux-style.com/tmp/state.glade
http://tux-style.com/tmp/searchFile.cpp (yes, I'm sure the correct glade is loaded!)

Please don't blame me for the code! It's a prototype software. :-)

But maybe someone is able to see the root of the problem...

> If it doesn't work, then I'd try (just in case) to change the name of
> the element (both in the file and
> in the code of the program, in the string you pass to
> Whatever->get_widget("ElementName", mUmlEditMenu).)

I also tried this without success.

libgtkmm-2.4-1c2a / 1:2.16.0-1
libgtk2.0-0 / 2.16.1-0ubuntu2

I'm short before constructing the Gtk::Menu by hand and not using Glade. But maybe it's
because my Ubuntu installation is a little old. Would anyone try my sources if I upload a
tarball?

regards
	Andreas


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