Re: [gtkmm] weird segfault
- From: "Rui Lopes" <rui ruilopes com>
- To: <gtkmm-list gnome org>
- Subject: Re: [gtkmm] weird segfault
- Date: Mon, 27 Jan 2003 14:40:32 -0000 (WET)
Hi,
> Rui Lopes wrote:
>
>>Hello all,
>>
>>I have this code,
[snip]
>>but it segfauls; here is the backtrace:
[snip]
> It looks to me like the RefPtr is keeping the Display object alive until
> the main() routine is finished, even though the X11 connection is
> destroyed before returning from run(). So when the Display object is
> finally destroyed, the underlying GTK+ routines trip over something (a
> stale pointer, perhaps) and fall down.
>
> You could try clearing your RefPtr before entering run() to avoid this.
> Presumably you won't need it after that point?
>
> ..mj
this was only a small example; it doesn't matter where I put that RefPtr,
for example with this,
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window window;
{ // note this extra compound block.
Glib::RefPtr<Gdk::Display> refDisplay = Gdk::Display::get_default();
}
Gtk::Main::run(window);
return 0;
}
this crashes in the destructor before reaching run.
btw, i'm not seeing why you have suggested the destruction of the RefPtr
before entering run().
-- Rui Lopes
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]