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

List:       kde-core-devel
Subject:    Re: Got some bugs here
From:       Michael Matz <matz () kde ! org>
Date:       2002-01-30 17:30:52
[Download RAW message or body]

Hi,

On Wed, 30 Jan 2002, Michael Goffioul wrote:

> > Try to redesign it to not require static objects.  If impossible use
> > KStaticDeleter.  Examples are all over kdelibs.
>
> In the case of KDEPrint, the potential crash cause (to be confirmed) is
> the pointer to KPrinterImpl object included in KPrinter. However, this
> KPrinterImpl object is owned by KMFactory whose deletion is controlled
> by KStaticDeleter. So the crash of Kate is possibly caused by the fact
> that static deleters are destroyed BEFORE the kate document is
> destroyed.
> Is this possible?

Yes, but only if either that document isn't destroyed at all or is
also controlled through a KStaticDeleter.  The point is: all static
objects are destroyed "after" program end (i.e. after main() returns), no
exception.  But in an _unspecified_ order.  The same holds for
KStaticDeleters.  If there are two static objects A and B, where B
contains a pointer to A, this is going to crash with probability 50
percent (when A is destroyed before B).  If there is only one static
object S (of class S) involved, and another non-static object N holds a
pointer to that, there _should_ be no problem, as at the point S gets
destroyed no code for N can possibly be executed anymore (it's after
main() after all), _except_ due to the calling of S::~S (let's say, also S
holds a ref to N) (or other static destructions), and in the course of
destructing itself, it calls some of N's methods which in turn try to
refer to the S (in destruction, or already destructed).  If that's not
possible with Kate/KPrinter/KPrinterCache (I haven't looked at the code at
all, sorry, I'm too under windows without real possibilities to do useful
things ;-) ) then that can't be the cause.


Ciao,
Michael.

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

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