Title: [153052] trunk/Source/WebKit/gtk
Revision
153052
Author
[email protected]
Date
2013-07-23 08:36:05 -0700 (Tue, 23 Jul 2013)

Log Message

[GTK] GtkAdjustmentWatcher idle source not correctly handled
https://bugs.webkit.org/show_bug.cgi?id=119003

Reviewed by Martin Robinson.

GtkAdjustmentWatcher::updateAdjustmentsFromScrollbarsLater()
creates a new idle source and initializes
m_updateAdjustmentCallbackId, which is used everywhere and
specially in the destructor to cancel the source when the
GtkAdjustmentWatcher is deleted. However,
m_updateAdjustmentCallbackId is reset to 0 in
GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars() only when
not returning early. This method is public and not only called by
the updateAdjustmentCallback, which means that a call to
updateAdjustmentsFromScrollbars could reset the
m_updateAdjustmentCallbackId without actually destroying the source.

* WebCoreSupport/GtkAdjustmentWatcher.cpp:
(WebKit::GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars):
Cancel the adjustment later idle if it has been scheduled.
(WebKit::GtkAdjustmentWatcher::updateAdjustmentCallback): Reset
m_updateAdjustmentCallbackId.
* WebCoreSupport/GtkAdjustmentWatcher.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/gtk/ChangeLog (153051 => 153052)


--- trunk/Source/WebKit/gtk/ChangeLog	2013-07-23 13:34:39 UTC (rev 153051)
+++ trunk/Source/WebKit/gtk/ChangeLog	2013-07-23 15:36:05 UTC (rev 153052)
@@ -1,3 +1,29 @@
+2013-07-23  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] GtkAdjustmentWatcher idle source not correctly handled
+        https://bugs.webkit.org/show_bug.cgi?id=119003
+
+        Reviewed by Martin Robinson.
+
+        GtkAdjustmentWatcher::updateAdjustmentsFromScrollbarsLater()
+        creates a new idle source and initializes
+        m_updateAdjustmentCallbackId, which is used everywhere and
+        specially in the destructor to cancel the source when the
+        GtkAdjustmentWatcher is deleted. However,
+        m_updateAdjustmentCallbackId is reset to 0 in
+        GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars() only when
+        not returning early. This method is public and not only called by
+        the updateAdjustmentCallback, which means that a call to
+        updateAdjustmentsFromScrollbars could reset the
+        m_updateAdjustmentCallbackId without actually destroying the source.
+
+        * WebCoreSupport/GtkAdjustmentWatcher.cpp:
+        (WebKit::GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars):
+        Cancel the adjustment later idle if it has been scheduled.
+        (WebKit::GtkAdjustmentWatcher::updateAdjustmentCallback): Reset
+        m_updateAdjustmentCallbackId.
+        * WebCoreSupport/GtkAdjustmentWatcher.h:
+
 2013-07-17  Kangil Han  <[email protected]>
 
         Use toHTMLMediaElement

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp (153051 => 153052)


--- trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp	2013-07-23 13:34:39 UTC (rev 153051)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp	2013-07-23 15:36:05 UTC (rev 153052)
@@ -68,11 +68,15 @@
     FrameView* frameView = core(m_webView)->mainFrame()->view();
     updateAdjustmentFromScrollbar(m_horizontalAdjustment.get(), frameView->horizontalScrollbar());
     updateAdjustmentFromScrollbar(m_verticalAdjustment.get(), frameView->verticalScrollbar());
-    m_updateAdjustmentCallbackId = 0;
+    if (m_updateAdjustmentCallbackId) {
+        g_source_remove(m_updateAdjustmentCallbackId);
+        m_updateAdjustmentCallbackId = 0;
+    }
 }
 
-static gboolean updateAdjustmentCallback(GtkAdjustmentWatcher* watcher)
+gboolean GtkAdjustmentWatcher::updateAdjustmentCallback(GtkAdjustmentWatcher* watcher)
 {
+    watcher->m_updateAdjustmentCallbackId = 0;
     watcher->updateAdjustmentsFromScrollbars();
     return FALSE;
 }

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.h (153051 => 153052)


--- trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.h	2013-07-23 13:34:39 UTC (rev 153051)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.h	2013-07-23 15:36:05 UTC (rev 153052)
@@ -43,6 +43,8 @@
     bool scrollbarsDisabled() const { return m_scrollbarsDisabled; };
 
 private:
+    static gboolean updateAdjustmentCallback(GtkAdjustmentWatcher*);
+
     WebKitWebView* m_webView;
     GRefPtr<GtkAdjustment> m_horizontalAdjustment;
     GRefPtr<GtkAdjustment> m_verticalAdjustment;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to