[webkit-reviews] review granted: [Bug 21594] [Gtk] Use GOwnPtr for code that needs it : [Attachment 55744] Convert many uses of raw pointers to GRefPtr and GOwnPtr in WebKitWebView

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 12 04:58:34 PDT 2010


Xan Lopez <xan.lopez at gmail.com> has granted Martin Robinson
<mrobinson at webkit.org>'s request for review:
Bug 21594: [Gtk] Use GOwnPtr for code that needs it
https://bugs.webkit.org/show_bug.cgi?id=21594

Attachment 55744: Convert many uses of raw pointers to GRefPtr and GOwnPtr in
WebKitWebView
https://bugs.webkit.org/attachment.cgi?id=55744&action=review

------- Additional Comments from Xan Lopez <xan.lopez at gmail.com>
>     if (priv->currentMenu) {
>-	  GtkMenu* menu = priv->currentMenu;
>-	  priv->currentMenu = 0;
>+	  GRefPtr<GtkMenu> menu(priv->currentMenu);
>+	  priv->currentMenu.clear();
> 
>-	  gtk_menu_popdown(menu);
>-	  g_object_unref(menu);
>+	  gtk_menu_popdown(menu.get());
>     }

Couldn't you just do an adoptGRef and get rid of the .clear() call?


 >-    if (hadj)
>-	  g_object_ref(hadj);
>-    if (vadj)
>-	  g_object_ref(vadj);
>-
>     WebKitWebViewPrivate* priv = webView->priv;
>-
>-    if (priv->horizontalAdjustment)
>-	  g_object_unref(priv->horizontalAdjustment);
>-    if (priv->verticalAdjustment)
>-	  g_object_unref(priv->verticalAdjustment);
>-
>     priv->horizontalAdjustment = hadj;
>     priv->verticalAdjustment = vadj;

This is so full of win I want to cry.

r=me, you can change the thing I pointed out if it makes sense to you.


More information about the webkit-reviews mailing list