[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: kdenonbeta/kopete/protocols/irc
From: Luis Pedro Coelho <luis_pedro () netcabo ! pt>
Date: 2003-03-14 18:49:00
[Download RAW message or body]
Le Vendredi 14 Mars 2003 19:35, Jason Keirstead a écrit :
> On March 14, 2003 02:27 pm, Olivier Goffart wrote:
> > and ~KC Runs *BEFORE* ~QObject is run and signal was emitted.
> >
> > I am sorry
>
> Well, just to prove you wrong, I changed the code to use destroyed()
> and a static_cast, and I am deleteing contacts, the slot is firing( I added
> a debug ) and it is working perfectly.
Of course it works (most of the time).
You are basically doing:
struct KC : QObject {
Qstring str;
};
KC* object = new KC;
object->str->~QString;
QString myStr = object->str;
The object has been destroyed, but just recently so the memory should still
contain the old values. The problem is that you are relying on undefined
behaviour (working on a deleted object) which means that all sorts of nasty
things are lyable to happen in a nasty sometimes-it-works-sometimes it
doesn't sort of way.
Please don't knowingly introduce such bad code into KDE.
Thank you,
--
Luis Pedro Coelho
http://blogs.salon.com/0001523
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic