Re: stupid segfaults -- argh!



On 6/5/06, Hargobind Khalsa <khalsah gmail com> wrote:
I think the problem with the code is that you are calling


Gtk::Main kit(argc, argv);

Inside your initialize() function.
When you then return to the main function the variable "kit" has gone out of
scope and has therefore been destroyed, effectively uninitializing GTKmm...
that's why

Gtk::Main kit(argc, argv);
is usually done in the main function.

If you were to store "kit" in a variable that has global scope or the scope
of main then you prevent this from happening.

Ah, that makes sense.

I wonder why the documentation says a Gtk::Main object can't be
created in the global scope.  Apparently, that's what I want to do, as
I can't put it inside main().

Joe



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