[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ariya at webkit.org ariya at webkit.org
Wed Dec 22 12:25:13 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b0ffb3c44c2179a2f31b64e621cc41ea44b949c2
Author: ariya at webkit.org <ariya at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 23 07:59:48 2010 +0000

    [Qt] Crash when purging the scratch buffer for the shadow
    https://bugs.webkit.org/show_bug.cgi?id=44384
    
    Patch by Ariya Hidayat <ariya at sencha.com> on 2010-08-23
    Reviewed by Kenneth Rohde Christiansen.
    
    WebCore::Timer can't be used in a static object bcause it relies on
    thread global data, which is invalid once the application instance is
    destroyed. To overcome the problem, use QObject's timer support for
    the ShadowBuffer class.
    
    * platform/graphics/qt/ContextShadow.cpp:
    (WebCore::):
    (WebCore::ShadowBuffer::ShadowBuffer):
    (WebCore::ShadowBuffer::schedulePurge):
    (WebCore::ShadowBuffer::timerEvent):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65795 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b61bc8f..e3ec39d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-08-23  Ariya Hidayat  <ariya at sencha.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Crash when purging the scratch buffer for the shadow
+        https://bugs.webkit.org/show_bug.cgi?id=44384
+
+        WebCore::Timer can't be used in a static object bcause it relies on
+        thread global data, which is invalid once the application instance is
+        destroyed. To overcome the problem, use QObject's timer support for
+        the ShadowBuffer class.
+
+        * platform/graphics/qt/ContextShadow.cpp:
+        (WebCore::):
+        (WebCore::ShadowBuffer::ShadowBuffer):
+        (WebCore::ShadowBuffer::schedulePurge):
+        (WebCore::ShadowBuffer::timerEvent):
+
 2010-08-23  Philippe Normand  <pnormand at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/platform/graphics/qt/ContextShadow.cpp b/WebCore/platform/graphics/qt/ContextShadow.cpp
index 83e291d..96d13fc 100644
--- a/WebCore/platform/graphics/qt/ContextShadow.cpp
+++ b/WebCore/platform/graphics/qt/ContextShadow.cpp
@@ -28,7 +28,7 @@
 #include "config.h"
 #include "ContextShadow.h"
 
-#include "Timer.h"
+#include <QTimerEvent>
 #include <wtf/Noncopyable.h>
 
 namespace WebCore {
@@ -37,22 +37,25 @@ namespace WebCore {
 // Instead of creating and destroying the buffer for every operation,
 // we create a buffer which will be automatically purged via a timer.
 
-class ShadowBuffer: public Noncopyable {
+class ShadowBuffer: public QObject {
 public:
-    ShadowBuffer();
+    ShadowBuffer(QObject* parent = 0);
 
     QImage* scratchImage(const QSize& size);
 
     void schedulePurge();
 
+protected:
+    void timerEvent(QTimerEvent* event);
+
 private:
     QImage image;
-    void purgeBuffer(Timer<ShadowBuffer>*);
-    Timer<ShadowBuffer> purgeTimer;
+    int timerId;
 };
 
-ShadowBuffer::ShadowBuffer()
-    : purgeTimer(this, &ShadowBuffer::purgeBuffer)
+ShadowBuffer::ShadowBuffer(QObject* parent)
+    : QObject(parent)
+    , timerId(0)
 {
 }
 
@@ -84,12 +87,17 @@ QImage* ShadowBuffer::scratchImage(const QSize& size)
 void ShadowBuffer::schedulePurge()
 {
     static const double BufferPurgeDelay = 2; // seconds
-    purgeTimer.startOneShot(BufferPurgeDelay);
+    killTimer(timerId);
+    timerId = startTimer(BufferPurgeDelay * 1000);
 }
 
-void ShadowBuffer::purgeBuffer(Timer<ShadowBuffer>*)
+void ShadowBuffer::timerEvent(QTimerEvent* event)
 {
-    image = QImage();
+    if (event->timerId() == timerId) {
+        killTimer(timerId);
+        image = QImage();
+    }
+    QObject::timerEvent(event);
 }
 
 Q_GLOBAL_STATIC(ShadowBuffer, scratchShadowBuffer)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list