[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdenonbeta/kopete/protocols/irc
From:       Jason Keirstead <jason () keirstead ! org>
Date:       2003-03-14 18:51:31
[Download RAW message or body]

On March 14, 2003 02:49 pm, Luis Pedro Coelho wrote:
> 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.
>

But I ran it though valgrind without incident?

-- 
Jason Keirstead, BCS
http://www.keirstead.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic