Can Q_GLOBAL_STATIC replace KStaticDelete ?

Thiago Macieira thiago at kde.org
Tue Jan 9 08:08:55 GMT 2007


Matthias Kretz wrote:
>With QCoreApplication gone the main thread cannot postEvents to the
> other thread anymore, which is needed to cleanly exit the thread.

This sounds like a Qt bug. You should be able to post events to other, 
still running threads. In fact, you should be able to post events even 
from non-QThread threads.

What you can't do is post events after the global static destructors have 
run, when the internal Qt event and object locks are gone.

>Using Solid a similar warning appeared:
>QObject::startTimer: QTimer can only be used with threads started with
> QThread
>
>The reason is that KLibrary wants to start a QTimer when the factory
> object is destroyed. (I committed a fix that checks for the presence of
>QCoreApplication::instance(), so that this warning is gone by now.)

This sounds like a KLibrary bug instead. The timer would never be run, so 
a new solution must be found.

From the other email:
>On Monday 08 January 2007 19:56, Thiago Macieira wrote:
>> What happens to those objects if the application exits without
>> QCoreApplication's destructor running?
>
>Forgot to answer this one... They are deleted by KStaticDeleter. But
>QCoreApplication has to be present for the destructors to work
> correctly.

I don't think it's a good idea to call an object from inside its 
destructor. In this case, we're at least reasonably sure that the 
callbacks are run very early...

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070109/cc16fe49/attachment.sig>


More information about the kde-core-devel mailing list