Gtkmm memory managament question and warning question



*/Question 1:/*
I'm building a GUI with Glade 3.6.3 (project file format GtkBuilder) and everything is shown on screen nicely. From what I've read in the .pdf book programming with gtkmm every widget that has a parent will be destroyed when its parent is destroyed. Top level widgets have to be deleted by the programmer (i got that).

When you only use code to build the GUI you have to use the method "void set_parent(Widget& parent)" from the Gtk::Widget class, but when you use Glade, *are the widgets automatically given a parent when adding items in Glade? Or do you have to set the parent in your code?*

*/Question 2:/*
In the program I'm making, I've managed to use a Gtk::FileChooserDialog to open a simple text file and display it in a Gtk::TextView which is inside a Gtk::Notebook so I can have several text files in the Notebook. I created the Gtk::Notebook with only 1 tab and its Gtk::TextView with Glade. When opening more text files another tab with another Gtk::TextView is added to the notebook, all that works for all the files I open. Those new tabs and the Gtk::TextView's are created dinamically with the *SomeWidget *pointerToAnyWidget=manage( new Something); *so when I add the pointer to a container, this new Widget is *manage()*d by the container and when the container is destroyed this new widget is destroyed as well. I have to say when I add them, I do it using only the *manage()* method, I don't use the *void set_parent(Widget& parent)* method.

So after opening, adding and displaying widgets, when I exit the program I get this warning:

*(main:9151): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.20.1/gobject/gsignal.c:2387: instance `0x8953e98' has no handler with id `446'*

one time for each file I opened, so let's say I opened 4 files (which are opened and displayed well) after closing the program I get 4 warnings. What changes on each warning is the `0x8953e98' and `446' fields. The main:9151 changes on each time I execute the program but it's the same for each warning.

I've read the reference manuals to figure out what that warning means, I believe it has to do with memory management but not sure. I have to add that the very first file you open is displayed on a tab and Gtk::TextView that were already inside the Glade file, if I open only 1 file and exit the program I still get the warning.

*Do you know what that warning means? Is that a memory leak? Should I worry about it?*

Sorry, If I wrote too much, I'm new to Gtkmm, I like it a lot and trying to learn it.

Thanks for your time and patience! :-)

Adrián Ortega











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