Title: [162122] trunk/Tools
- Revision
- 162122
- Author
- [email protected]
- Date
- 2014-01-16 03:12:36 -0800 (Thu, 16 Jan 2014)
Log Message
[GTK][MiniBrowser] The progress entry reset callback can be fired after the BrowserWindow is destroyed
https://bugs.webkit.org/show_bug.cgi?id=127083
Reviewed by Carlos Garcia Campos.
When the load progress reaches 1.0 (i.e. 100%), a timeout callback is set up in webViewLoadProgressChanged.
The progress entry is then reset back to 0 in that callback and the timeout source is removed.
The callback can be fired after the relevant BrowserWindow and its progress entry are destroyed, causing
assertion failures in gtk_entry_set_progress_fraction due to an invalid GtkEntry object. To avoid that,
To avoid that, the ID of the timeout source is stored on the BrowserWindow and is destroyed when the
BrowserWindow object is being finalized, preventing the callback from firing.
* MiniBrowser/gtk/BrowserWindow.c:
(resetEntryProgress):
(webViewLoadProgressChanged):
(browserWindowFinalize):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (162121 => 162122)
--- trunk/Tools/ChangeLog 2014-01-16 10:53:18 UTC (rev 162121)
+++ trunk/Tools/ChangeLog 2014-01-16 11:12:36 UTC (rev 162122)
@@ -1,3 +1,23 @@
+2014-01-16 Zan Dobersek <[email protected]>
+
+ [GTK][MiniBrowser] The progress entry reset callback can be fired after the BrowserWindow is destroyed
+ https://bugs.webkit.org/show_bug.cgi?id=127083
+
+ Reviewed by Carlos Garcia Campos.
+
+ When the load progress reaches 1.0 (i.e. 100%), a timeout callback is set up in webViewLoadProgressChanged.
+ The progress entry is then reset back to 0 in that callback and the timeout source is removed.
+
+ The callback can be fired after the relevant BrowserWindow and its progress entry are destroyed, causing
+ assertion failures in gtk_entry_set_progress_fraction due to an invalid GtkEntry object. To avoid that,
+ To avoid that, the ID of the timeout source is stored on the BrowserWindow and is destroyed when the
+ BrowserWindow object is being finalized, preventing the callback from firing.
+
+ * MiniBrowser/gtk/BrowserWindow.c:
+ (resetEntryProgress):
+ (webViewLoadProgressChanged):
+ (browserWindowFinalize):
+
2014-01-15 Alexey Proskuryakov <[email protected]>
DumpRenderTree doesn't disable web preferences autosave
Modified: trunk/Tools/MiniBrowser/gtk/BrowserWindow.c (162121 => 162122)
--- trunk/Tools/MiniBrowser/gtk/BrowserWindow.c 2014-01-16 10:53:18 UTC (rev 162121)
+++ trunk/Tools/MiniBrowser/gtk/BrowserWindow.c 2014-01-16 11:12:36 UTC (rev 162122)
@@ -61,6 +61,7 @@
GtkWidget *fullScreenMessageLabel;
GtkWindow *parentWindow;
guint fullScreenMessageLabelId;
+ guint resetEntryProgressTimeoutId;
};
struct _BrowserWindowClass {
@@ -154,9 +155,10 @@
gtk_window_set_title(GTK_WINDOW(window), title ? title : defaultWindowTitle);
}
-static gboolean resetEntryProgress(GtkEntry *entry)
+static gboolean resetEntryProgress(BrowserWindow *window)
{
- gtk_entry_set_progress_fraction(entry, 0);
+ gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), 0);
+ window->resetEntryProgressTimeoutId = 0;
return FALSE;
}
@@ -165,8 +167,8 @@
gdouble progress = webkit_web_view_get_estimated_load_progress(webView);
gtk_entry_set_progress_fraction(GTK_ENTRY(window->uriEntry), progress);
if (progress == 1.0) {
- guint id = g_timeout_add(500, (GSourceFunc)resetEntryProgress, window->uriEntry);
- g_source_set_name_by_id(id, "[WebKit] resetEntryProgress");
+ window->resetEntryProgressTimeoutId = g_timeout_add(500, (GSourceFunc)resetEntryProgress, window);
+ g_source_set_name_by_id(window->resetEntryProgressTimeoutId, "[WebKit] resetEntryProgress");
}
}
@@ -514,6 +516,9 @@
if (window->fullScreenMessageLabelId)
g_source_remove(window->fullScreenMessageLabelId);
+ if (window->resetEntryProgressTimeoutId)
+ g_source_remove(window->resetEntryProgressTimeoutId);
+
G_OBJECT_CLASS(browser_window_parent_class)->finalize(gObject);
if (g_atomic_int_dec_and_test(&windowCount))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes