Skip to content

Commit

Permalink
Merge r162188 - [GTK] Remove the weak pointer added to the web view i…
Browse files Browse the repository at this point in the history
…n WebKitPrintOperation

https://bugs.webkit.org/show_bug.cgi?id=127098

Reviewed by Martin Robinson.

If the print operation finishes and the web view is still alive,
the weak pointer added to the view should be removed.

* UIProcess/API/gtk/WebKitPrintOperation.cpp:
(_WebKitPrintOperationPrivate::~_WebKitPrintOperationPrivate):
  • Loading branch information
carlosgcampos committed Jan 20, 2014
1 parent a11826f commit 9b2c389
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
13 changes: 13 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,16 @@
2014-01-16 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] Remove the weak pointer added to the web view in WebKitPrintOperation
https://bugs.webkit.org/show_bug.cgi?id=127098

Reviewed by Martin Robinson.

If the print operation finishes and the web view is still alive,
the weak pointer added to the view should be removed.

* UIProcess/API/gtk/WebKitPrintOperation.cpp:
(_WebKitPrintOperationPrivate::~_WebKitPrintOperationPrivate):

2014-01-14 Carlos Garcia Campos <cgarcia@igalia.com>

[GTK] UI process crashes when closing the window right after printing with javascript
Expand Down
15 changes: 9 additions & 6 deletions Source/WebKit2/UIProcess/API/gtk/WebKitPrintOperation.cpp
Expand Up @@ -65,6 +65,12 @@ enum {
};

struct _WebKitPrintOperationPrivate {
~_WebKitPrintOperationPrivate()
{
if (webView)
g_object_remove_weak_pointer(G_OBJECT(webView), reinterpret_cast<void**>(&webView));
}

WebKitWebView* webView;
PrintInfo::PrintMode printMode;

Expand All @@ -78,13 +84,10 @@ WEBKIT_DEFINE_TYPE(WebKitPrintOperation, webkit_print_operation, G_TYPE_OBJECT)

static void webkitPrintOperationConstructed(GObject* object)
{
WebKitPrintOperation* printOperation = WEBKIT_PRINT_OPERATION(object);
WebKitPrintOperationPrivate* priv = printOperation->priv;

if (G_OBJECT_CLASS(webkit_print_operation_parent_class)->constructed)
G_OBJECT_CLASS(webkit_print_operation_parent_class)->constructed(object);
G_OBJECT_CLASS(webkit_print_operation_parent_class)->constructed(object);

g_object_add_weak_pointer(G_OBJECT(priv->webView), (gpointer*)&priv->webView);
WebKitPrintOperationPrivate* priv = WEBKIT_PRINT_OPERATION(object)->priv;
g_object_add_weak_pointer(G_OBJECT(priv->webView), reinterpret_cast<void**>(&priv->webView));
}

static void webkitPrintOperationGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
Expand Down

0 comments on commit 9b2c389

Please sign in to comment.