Changeset 75935 in webkit


Ignore:
Timestamp:
Jan 17, 2011 5:28:53 AM (13 years ago)
Author:
kbalazs@webkit.org
Message:

2011-01-17 Balazs Kelemen <kbalazs@webkit.org>

Reviewed by Andreas Kling.

[Qt][WK2] Crash due to double destruction of QSharedMemory
https://bugs.webkit.org/show_bug.cgi?id=52569

Avoid deleting the QSharedMemory twice.

  • Platform/qt/SharedMemoryQt.cpp: (WebKit::SharedMemory::~SharedMemory):
  • Shared/qt/CleanupHandler.cpp: Renamed m_inDeleteObjects to m_hasStartedDeleting and added a getter for it. (WebKit::CleanupHandler::CleanupHandler): (WebKit::CleanupHandler::deleteObjects):
  • Shared/qt/CleanupHandler.h: (WebKit::CleanupHandler::unmark): (WebKit::CleanupHandler::hasStartedDeleting):
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r75880 r75935  
     12011-01-17  Balazs Kelemen  <kbalazs@webkit.org>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt][WK2] Crash due to double destruction of QSharedMemory
     6        https://bugs.webkit.org/show_bug.cgi?id=52569
     7
     8        Avoid deleting the QSharedMemory twice.
     9        * Platform/qt/SharedMemoryQt.cpp:
     10        (WebKit::SharedMemory::~SharedMemory):
     11        * Shared/qt/CleanupHandler.cpp:
     12        Renamed m_inDeleteObjects to m_hasStartedDeleting and
     13        added a getter for it.
     14        (WebKit::CleanupHandler::CleanupHandler):
     15        (WebKit::CleanupHandler::deleteObjects):
     16        * Shared/qt/CleanupHandler.h:
     17        (WebKit::CleanupHandler::unmark):
     18        (WebKit::CleanupHandler::hasStartedDeleting):
     19
    1202011-01-15  Adam Barth  <abarth@webkit.org>
    221
  • trunk/Source/WebKit2/Platform/qt/SharedMemoryQt.cpp

    r74967 r75935  
    145145SharedMemory::~SharedMemory()
    146146{
     147    if (CleanupHandler::instance()->hasStartedDeleting())
     148        return;
     149
    147150    CleanupHandler::instance()->unmark(m_impl);
    148151    delete m_impl;
  • trunk/Source/WebKit2/Shared/qt/CleanupHandler.cpp

    r74967 r75935  
    3737
    3838CleanupHandler::CleanupHandler()
    39     : m_inDeleteObjects(false)
     39    : m_hasStartedDeleting(false)
    4040{
    4141    moveToThread(qApp->thread()); // Ensure that we are acting on the main thread.
     
    5151void CleanupHandler::deleteObjects()
    5252{
    53     m_inDeleteObjects = true;
     53    m_hasStartedDeleting = true;
    5454    for (unsigned i = 0; i < m_objects.size(); ++i)
    5555        m_objects[i]->deleteLater();
  • trunk/Source/WebKit2/Shared/qt/CleanupHandler.h

    r74967 r75935  
    5252    void unmark(QObject* object)
    5353    {
    54         if (m_inDeleteObjects)
     54        if (m_hasStartedDeleting)
    5555            return;
    5656        m_objects.removeOne(object);
    5757    }
     58
     59    bool hasStartedDeleting() const { return m_hasStartedDeleting; }
    5860
    5961private slots:
     
    6769
    6870    QList<QObject*> m_objects;
    69     bool m_inDeleteObjects;
     71    bool m_hasStartedDeleting;
    7072};
    7173
Note: See TracChangeset for help on using the changeset viewer.