Changeset 85390 in webkit


Ignore:
Timestamp:
Apr 29, 2011 10:20:07 PM (13 years ago)
Author:
xan@webkit.org
Message:

2011-04-29 Xan Lopez <xlopez@igalia.com>

Reviewed by Martin Robinson.

[Gtk+] Crash when navigating back
https://bugs.webkit.org/show_bug.cgi?id=59799

The innerNode management in WebKitHitTestResult was relying on the
old DOM bindings behavior where every DOM objects had to be
disposed by the caller. Now the objects are garbage collected by
WebKit when either the parent frame or document dies, so this is
not needed anymore. Update the code to simply take ownership of
the node, which effectively correctly balances the reference
count.

  • webkit/webkithittestresult.cpp: (webkit_hit_test_result_dispose): call C++ dtors in private data. (webkit_hit_test_result_get_property): adatp to GRefPtr API. (webkit_hit_test_result_init): call C++ ctors in private data.
Location:
trunk/Source/WebKit/gtk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/gtk/ChangeLog

    r85229 r85390  
     12011-04-29  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [Gtk+] Crash when navigating back
     6        https://bugs.webkit.org/show_bug.cgi?id=59799
     7
     8        The innerNode management in WebKitHitTestResult was relying on the
     9        old DOM bindings behavior where every DOM objects had to be
     10        disposed by the caller. Now the objects are garbage collected by
     11        WebKit when either the parent frame or document dies, so this is
     12        not needed anymore. Update the code to simply take ownership of
     13        the node, which effectively correctly balances the reference
     14        count.
     15
     16        * webkit/webkithittestresult.cpp:
     17        (webkit_hit_test_result_dispose): call C++ dtors in private data.
     18        (webkit_hit_test_result_get_property): adatp to GRefPtr API.
     19        (webkit_hit_test_result_init): call C++ ctors in private data.
     20
    1212011-04-28  Xan Lopez  <xlopez@igalia.com>
    222
  • trunk/Source/WebKit/gtk/webkit/webkithittestresult.cpp

    r74933 r85390  
    2323
    2424#include "GOwnPtr.h"
     25#include "GRefPtr.h"
    2526#include "HitTestResult.h"
    2627#include "KURL.h"
     
    4849    char* imageURI;
    4950    char* mediaURI;
    50     WebKitDOMNode* innerNode;
     51    GRefPtr<WebKitDOMNode> innerNode;
    5152};
    5253
     
    7576static void webkit_hit_test_result_dispose(GObject* object)
    7677{
    77     g_object_unref(WEBKIT_HIT_TEST_RESULT(object)->priv->innerNode);
     78    WEBKIT_HIT_TEST_RESULT(object)->priv->~WebKitHitTestResultPrivate();
    7879
    7980    G_OBJECT_CLASS(webkit_hit_test_result_parent_class)->dispose(object);
     
    99100        break;
    100101    case PROP_INNER_NODE:
    101         g_value_set_object(value, priv->innerNode);
     102        g_value_set_object(value, priv->innerNode.get());
    102103        break;
    103104    default:
     
    231232{
    232233    web_hit_test_result->priv = G_TYPE_INSTANCE_GET_PRIVATE(web_hit_test_result, WEBKIT_TYPE_HIT_TEST_RESULT, WebKitHitTestResultPrivate);
     234    new (web_hit_test_result->priv) WebKitHitTestResultPrivate();
    233235}
    234236
Note: See TracChangeset for help on using the changeset viewer.