[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-dev] Pervasive bug on dialog handling
- From: Alex Bligh <alex@xxxxxxxxxxx>
- Date: Tue, 02 May 2006 17:58:08 +0100
- Subject: [XaraXtreme-dev] Pervasive bug on dialog handling
There appears to be a pervasive bug in dialog handling (as illustrated
by Bug #993). I think it's in Xtreme too.
Essentially, if you process your own cancel / commit buttons (and
thus do End()), you should be aware that End() deletes "this"
(i.e. the object concerned). You should not then do other stuff
with the object, because it is deleted. A good thing to
avoid is calling the base-class message handler. Sadly, a lot
of dialog code seems to do this.
I will fully admit to making things (a bit) worse by trying to
do stuff in the base class message handler, but let's face
it calling functions when you have a deleted "this" pointer
is a seriously bad idea, so this was always
a disaster area waiting to happen. It is also (for complex
reasons) much less of a disaster area on debug builds (see
bug 933 for details) as the memory zapping we do of deallocated
memory actually helps. In retail builds, the fact the data
is /nearly/ right is downright dangerous.
I can't tell you if there are any definite occasions when
deallocated memory is referenced on Xtreme, but I think
it is reasonably likely. Dialog handling has changed sufficiently
in LX that it's difficult to tell for sure.