Changeset 59057 in webkit


Ignore:
Timestamp:
May 9, 2010 9:37:25 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-05-09 Noam Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Crash in QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate when animation were used
https://bugs.webkit.org/show_bug.cgi?id=38574

The fix uses a QWeakPointer for rootGraphicsLayer, protecting from a crash in case the layer is deleted before the QGraphicsWebView.

  • Api/qgraphicswebview.cpp: (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate): (QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate): (QGraphicsWebViewPrivate::setRootGraphicsLayer): (QGraphicsWebViewPrivate::updateCompositingScrollPosition):
Location:
trunk/WebKit/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qgraphicswebview.cpp

    r58877 r59057  
    8383        , resizesToContents(false)
    8484#if USE(ACCELERATED_COMPOSITING)
    85         , rootGraphicsLayer(0)
    8685        , shouldSync(false)
    8786#endif
     
    159158
    160159#if USE(ACCELERATED_COMPOSITING)
    161     QGraphicsItem* rootGraphicsLayer;
     160    QWeakPointer<QGraphicsObject> rootGraphicsLayer;
    162161    // we need to sync the layers if we get a special call from the WebCore
    163162    // compositor telling us to do so. We'll get that call from ChromeClientQt
     
    172171{
    173172#if USE(ACCELERATED_COMPOSITING)
    174     if (rootGraphicsLayer) {
    175         // we don't need to delete the root graphics layer
    176         // The lifecycle is managed in GraphicsLayerQt.cpp
    177         rootGraphicsLayer->setParentItem(0);
    178         q->scene()->removeItem(rootGraphicsLayer);
    179     }
     173    if (!rootGraphicsLayer)
     174        return;
     175    // we don't need to delete the root graphics layer. The lifecycle is managed in GraphicsLayerQt.cpp.
     176    rootGraphicsLayer.data()->setParentItem(0);
     177    q->scene()->removeItem(rootGraphicsLayer.data());
    180178#endif
    181179}
     
    205203{
    206204    if (rootGraphicsLayer) {
    207         rootGraphicsLayer->setParentItem(0);
    208         q->scene()->removeItem(rootGraphicsLayer);
     205        rootGraphicsLayer.data()->setParentItem(0);
     206        q->scene()->removeItem(rootGraphicsLayer.data());
    209207        QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive();
    210208    }
    211209
    212     rootGraphicsLayer = layer;
     210    rootGraphicsLayer = layer ? layer->toGraphicsObject() : 0;
    213211
    214212    if (layer) {
     
    232230    if (rootGraphicsLayer && q->page() && q->page()->mainFrame()) {
    233231        const QPoint scrollPosition = q->page()->mainFrame()->scrollPosition();
    234         rootGraphicsLayer->setPos(-scrollPosition);
     232        rootGraphicsLayer.data()->setPos(-scrollPosition);
    235233    }
    236234}
  • trunk/WebKit/qt/ChangeLog

    r59033 r59057  
     12010-05-09  Noam Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Crash in QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate when animation were used
     6        https://bugs.webkit.org/show_bug.cgi?id=38574
     7
     8        The fix uses a QWeakPointer for rootGraphicsLayer, protecting from a crash in case the layer is deleted before the QGraphicsWebView.
     9
     10        * Api/qgraphicswebview.cpp:
     11        (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate):
     12        (QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate):
     13        (QGraphicsWebViewPrivate::setRootGraphicsLayer):
     14        (QGraphicsWebViewPrivate::updateCompositingScrollPosition):
     15
    1162010-05-08  Luiz Agostini  <luiz.agostini@openbossa.org>
    217
Note: See TracChangeset for help on using the changeset viewer.