Re: Equivalent of the gtk g_object_ref/unref functions in gtkmm?



[Repost, forgot the send a copy to the list]

Paul Davis wrote:
On 3/26/07, Jef Driesen <jefdriesen hotmail com> wrote:
Murray Cumming wrote:
On Mon, 2007-03-26 at 16:30 +0200, Jef Driesen wrote:
Jonathon Jongsma wrote:
On 3/26/07, Jef Driesen <jefdriesen hotmail com> wrote:
The application works fine, but closing the main window results in a
segmentation fault (core dump). As far as I can tell (from a gdb
backtrace) the crash is not in my own code, but somewhere inside the
gtk(mm) library.
Could you provide the backtrace?  that might be helpful information.
Sometimes I don't get the segmentation fault, but only a large number of
errors. See attachment for both the backtrace and the errors.
If you get glib errors, try debuggin with --g-fatal-warnings, or with a
breakpoing on g_log. Then you'll get a backtrace at the relevant point.
Backtrace attached, although it doesn't seem to provide much more
information to me.

valgrind's memcheck is also incredibly helpful. Trust us on this. You
won't regret trying it.
I get lots of errors from valgrind, but I also get them for the trivial
program

int main (int argc, char *argv[])
{
     Gtk::Main kit(argc, argv);
     Gtk::Window window;
     kit.run(window);
     return 0;
}

But to be honest I never used valgrind before, so I could be using it wrong.

By chance, does your vbox3 that you pull out of glade contain a
Gtk::Menu? I seem to remember reading somewhere about a problem
pulling the menu out of glade but not the window that contains it.

Although, I can't recall this ever happening to me...

That could be the problem, because the vbox contains an (unused)
menubar. Removing that menubar from the glade file fixes the problem.

You might try having your Application class have the top level window
as a member variable that gets pulled out of the glade file instead of
inheriting from Gtk::Window.  You should be able to test that in about
5 minutes and see if it makes a difference.

This also fixes the crash.





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