Changeset 57818 in webkit


Ignore:
Timestamp:
Apr 19, 2010 11:00:58 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-19 Balazs Kelemen <kb@inf.u-szeged.hu>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Destroy SharedTimerQt before destruction of QCoreApplication.

To avoid unsafe situations caused by running WebCore code (through firing timers) when destruction of QCoreApplication
has been started, we should explicitly destroy the SharedTimerQt instance on application exit.
We can achieve that through installing a self-destroying slot for the QCoreApplication::aboutToQuit() signal
into the SharedTimerQt instance.

https://bugs.webkit.org/show_bug.cgi?id=36832

No functional change so no new tests.

  • platform/qt/SharedTimerQt.cpp: (WebCore::SharedTimerQt::SharedTimerQt): (WebCore::SharedTimerQt::destroy): (WebCore::SharedTimerQt::inst):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57817 r57818  
     12010-04-19  Balazs Kelemen  <kb@inf.u-szeged.hu>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Destroy SharedTimerQt before destruction of QCoreApplication.
     6
     7        To avoid unsafe situations caused by running WebCore code (through firing timers) when destruction of QCoreApplication
     8        has been started, we should explicitly destroy the SharedTimerQt instance on application exit.
     9        We can achieve that through installing a self-destroying slot for the QCoreApplication::aboutToQuit() signal
     10        into the SharedTimerQt instance.
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=36832
     13
     14        No functional change so no new tests.
     15
     16        * platform/qt/SharedTimerQt.cpp:
     17        (WebCore::SharedTimerQt::SharedTimerQt):
     18        (WebCore::SharedTimerQt::destroy):
     19        (WebCore::SharedTimerQt::inst):
     20
    1212010-04-19  Dan Bernstein  <mitz@apple.com>
    222
  • trunk/WebCore/platform/qt/SharedTimerQt.cpp

    r40160 r57818  
    4141
    4242class SharedTimerQt : public QObject {
     43    Q_OBJECT
     44
    4345    friend void setSharedTimerFiredFunction(void (*f)());
    4446public:
     
    5153    void timerEvent(QTimerEvent* ev);
    5254
     55private slots:
     56    void destroy();
     57
    5358private:
    54     SharedTimerQt(QObject* parent);
     59    SharedTimerQt();
    5560    ~SharedTimerQt();
    5661    QBasicTimer m_timer;
     
    5863};
    5964
    60 SharedTimerQt::SharedTimerQt(QObject* parent)
    61     : QObject(parent)
     65SharedTimerQt::SharedTimerQt()
     66    : QObject()
    6267    , m_timerFunction(0)
    6368{}
     
    6974}
    7075
     76void SharedTimerQt::destroy()
     77{
     78    delete this;
     79}
     80
    7181SharedTimerQt* SharedTimerQt::inst()
    7282{
    7383    static QPointer<SharedTimerQt> timer;
    74     if (!timer)
    75         timer = new SharedTimerQt(QCoreApplication::instance());
     84    if (!timer) {
     85        timer = new SharedTimerQt();
     86        timer->connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(destroy()));
     87    }
    7688
    7789    return timer;
     
    130142}
    131143
     144#include "SharedTimerQt.moc"
     145
    132146}
    133147
Note: See TracChangeset for help on using the changeset viewer.