paragui-dev
[Top][All Lists]
Advanced

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

Re: [paragui-dev] shutdown deletes objects twice


From: Alexander Pipelka
Subject: Re: [paragui-dev] shutdown deletes objects twice
Date: Sat, 11 Jun 2005 17:25:30 +0200

Am Samstag, den 11.06.2005, 16:36 +0200 schrieb Martin Bickel:
> On Sat, 11 Jun 2005 09:52:27 +0200, Alexander Pipelka wrote:
> 
> >Please check if the attached patch solves the problem.
> 
> No, it doesn't fix the problem.
Right. The supplied patch is crap :)

> I've found that there is already a test case for that problem:
> test/dropdown.cpp
> It even has the comment "This sample app demonstrates a really ugly
> bug".
> The program crashes on exit. And valgrind clearly shows why.
Yes. Checked that.

I found that the problem is *not* inside the destructor of PG_DropDown
but in the shutdown procedure of PG_Application. The loop prereads the
pointer to the next object in the list. If a PG_DropDown object gets
removed, the destructor will delete and remove the ListBox object (the
next in the list). The next iteration in the shutdown loop will try to
delete the invalid pointer,.... bang.

The attached patch fixes this problem (Checked with valgrind).

Please reverse my previous patch and apply this one.

> What do you think of the following solution:
> 
> Adding a signal "sigDelete" to PG_Widget which is called by the
> destructor of PG_Widget.
> The DropDown-Menu could then hook that signal of its DropList  and set
> the my_DropList variable to NULL if it is fired.
Hopefully not needed anymore.

Alex

Attachment: pgapplication.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]