Re: [[gtkmm] Destroying container problem]
- From: Olivier Samyn <osamyn ulb ac be>
- To: gtkmm <gtkmm-list gnome org>
- Subject: Re: [[gtkmm] Destroying container problem]
- Date: 03 Jul 2002 09:28:45 +0200
Le mar 02/07/2002 à 18:04, Murray Cumming a écrit :
> On Tue, 2002-07-02 at 16:40, Andrew E. Makeev wrote:
> > Murray Cumming wrote:
> >
> > > "Andrew E. Makeev" <andrew solvo ru> wrote:
> > > > I had Segfault signal on application exit.
> > > > Problem occured in dynamic_cast<> call in following fragment of
> > > > gtkmm/container.cc module:
> > > > ..
> > > > void Container_Class::remove_callback(GtkContainer* self, GtkWidget* p0)
> > >
> > > Please add a complete, simple, compileable example to bugzilla. I solved a
> > > similar problem recently, but then we made some major changes to this stuff
> > > and maybe we've broken it again.
> > >
> >
> > Unfortunatelly, I couldn't reproduce this one with small example...
> > Staring to guess again, I made something wrong in my original app. It's not so
> > big to explore, but I don't think it's a good idea to waste your time on
> > fixing my code :), is it?
>
> You need to break it down. I wouldn't do anything that you couldn't do,
> until you discover something that you think is a gtkmm bug.
>
I had a similar problem when using a timer in one of my application...
I seems there is a concurency access problem when deleting objects.
After some try I think I found the problem. It comes with SigC+++ slots.
In my program I used:
-------------------------------------------------------------------------
MainWindow::MainWindow ()
{
....
Gtk::EventBox *eventbox = manage (new Gtk::EventBox());
mouseHandler = new MouseHandler(this);
eventbox->signal_motion_notify_event().connect(
slot(*mouseHandler, &Fract::MouseHandler::cursorMove));
eventbox->set_events(eventbox->get_events()|
Gdk::POINTER_MOTION_MASK);
....
};
MainWindow::~MainWindow ()
{
...
delete mouseHandler;
...
};
-------------------------------------------------------------------------
It seems the problem comes with SigC++. When you're closing the
application and you mouse is moving the mouseHandler is already
destroyed and is called by the previous binding.
The solution is to replace the new/delete part with:
mouseHandler = manage(new MouseHandler(this));
This solved my problem... I think (don't verifyed) before deleting an
object SigC++ unbind all binded objects functions...
Another solution is maybe doing an unbind your self. But I don't tried
this.
Oleastre
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]