Changeset 106831 in webkit


Ignore:
Timestamp:
Feb 6, 2012 12:12:38 PM (12 years ago)
Author:
kov@webkit.org
Message:

[GTK] Insta-crash when closing browser with inspector window opened
https://bugs.webkit.org/show_bug.cgi?id=50744

Reviewed by Martin Robinson.

Source/WebKit/gtk:

  • GNUmakefile.am:
  • WebCoreSupport/InspectorClientGtk.cpp:

(WebKit::InspectorClient::releaseFrontendPage): also let go of the
frontend client when releasing the frontend page;
(WebKit::InspectorFrontendClient::~InspectorFrontendClient(): Call releaseFrontendPage()
like other ports do instead of just disconnectFrontendClient().
(WebKit::InspectorFrontendClient::destroyInspectorWindow): Use GRefPtr for the
inspector ref.
(WebKit::InspectorFrontendClient::bringToFront): Adjust for GRefPtr usage.
(WebKit::InspectorFrontendClient::attachWindow): Ditto.
(WebKit::InspectorFrontendClient::detachWindow): Ditto.
(WebKit::InspectorFrontendClient::inspectedURLChanged): Ditto.

  • WebCoreSupport/InspectorClientGtk.h:

(InspectorFrontendClient): Use GRefPtr for inspector member.

  • tests/testwebinspector.c: Added. Test that killing a WebView with the inspector

open does not crash, and that closing and reinspecting works.
(quitLoop):
(consoleMessageCallback):
(inspectElementCallback):
(closeInspector):
(showInspector):
(test_webkit_web_inspector_close_and_inspect):
(test_webkit_web_inspector_destroy_inspected_web_view):
(main):

LayoutTests:

  • platform/gtk/Skipped: unskip inspector/debugger/open-close-open.html,

which now passes.

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r106830 r106831  
     12012-02-05  Gustavo Noronha Silva  <gns@gnome.org>
     2
     3        [GTK] Insta-crash when closing browser with inspector window opened
     4        https://bugs.webkit.org/show_bug.cgi?id=50744
     5
     6        Reviewed by Martin Robinson.
     7
     8        * platform/gtk/Skipped: unskip inspector/debugger/open-close-open.html,
     9        which now passes.
     10
    1112012-02-06  Joshua Bell  <jsbell@chromium.org>
    212
  • trunk/LayoutTests/platform/gtk/Skipped

    r106632 r106831  
    101101# This test crashes whatever test follows it. Perhaps it's related to the previous failure.
    102102fast/dom/gc-10.html
    103 
    104 # https://bugs.webkit.org/show_bug.cgi?id=50744
    105 inspector/debugger/open-close-open.html
    106103
    107104# [GTK] fast/workers/storage/use-same-database-in-page-and-workers.html fails an ASSERT
  • trunk/Source/WebKit/gtk/ChangeLog

    r106828 r106831  
     12012-02-05  Gustavo Noronha Silva  <gns@gnome.org>
     2
     3        [GTK] Insta-crash when closing browser with inspector window opened
     4        https://bugs.webkit.org/show_bug.cgi?id=50744
     5
     6        Reviewed by Martin Robinson.
     7
     8        * GNUmakefile.am:
     9        * WebCoreSupport/InspectorClientGtk.cpp:
     10        (WebKit::InspectorClient::releaseFrontendPage): also let go of the
     11        frontend client when releasing the frontend page;
     12        (WebKit::InspectorFrontendClient::~InspectorFrontendClient(): Call releaseFrontendPage()
     13        like other ports do instead of just disconnectFrontendClient().
     14        (WebKit::InspectorFrontendClient::destroyInspectorWindow): Use GRefPtr for the
     15        inspector ref.
     16        (WebKit::InspectorFrontendClient::bringToFront): Adjust for GRefPtr usage.
     17        (WebKit::InspectorFrontendClient::attachWindow): Ditto.
     18        (WebKit::InspectorFrontendClient::detachWindow): Ditto.
     19        (WebKit::InspectorFrontendClient::inspectedURLChanged): Ditto.
     20        * WebCoreSupport/InspectorClientGtk.h:
     21        (InspectorFrontendClient): Use GRefPtr for inspector member.
     22        * tests/testwebinspector.c: Added. Test that killing a WebView with the inspector
     23        open does not crash, and that closing and reinspecting works.
     24        (quitLoop):
     25        (consoleMessageCallback):
     26        (inspectElementCallback):
     27        (closeInspector):
     28        (showInspector):
     29        (test_webkit_web_inspector_close_and_inspect):
     30        (test_webkit_web_inspector_destroy_inspected_web_view):
     31        (main):
     32
    1332012-02-06  Gustavo Noronha Silva  <gns@gnome.org>
    234
  • trunk/Source/WebKit/gtk/GNUmakefile.am

    r106537 r106831  
    457457        Programs/unittests/testatkroles \
    458458        Programs/unittests/testhittestresult \
     459        Programs/unittests/testwebinspector \
    459460        Programs/unittests/testwebsettings \
    460461        Programs/unittests/testwebresource \
     
    555556Programs_unittests_testatkroles_LDADD = $(webkit_tests_ldadd)
    556557Programs_unittests_testatkroles_LDFLAGS = $(webkit_tests_ldflags)
     558
     559Programs_unittests_testwebinspector_SOURCES = Source/WebKit/gtk/tests/testwebinspector.c Source/WebKit/gtk/tests/test_utils.c
     560Programs_unittests_testwebinspector_CFLAGS = $(webkit_tests_cflags)
     561Programs_unittests_testwebinspector_LDADD = $(webkit_tests_ldadd)
     562Programs_unittests_testwebinspector_LDFLAGS = $(webkit_tests_ldflags)
    557563
    558564Programs_unittests_testwebsettings_SOURCES = Source/WebKit/gtk/tests/testwebsettings.c
  • trunk/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp

    r101201 r106831  
    11/*
    2  * Copyright (C) 2008 Gustavo Noronha Silva
     2 * Copyright (C) 2008, 2012 Gustavo Noronha Silva
    33 * Copyright (C) 2010 Collabora Ltd.
    44 *
     
    172172{
    173173    m_frontendPage = 0;
     174    m_frontendClient = 0;
    174175}
    175176
     
    221222{
    222223    if (m_inspectorClient) {
    223         m_inspectorClient->disconnectFrontendClient();
     224        m_inspectorClient->releaseFrontendPage();
    224225        m_inspectorClient = 0;
    225226    }
     227
    226228    ASSERT(!m_webInspector);
    227229}
     
    231233    if (!m_webInspector)
    232234        return;
    233     WebKitWebInspector* webInspector = m_webInspector;
    234     m_webInspector = 0;
    235 
    236     g_signal_handlers_disconnect_by_func(m_inspectorWebView, (gpointer)notifyWebViewDestroyed, (gpointer)this);
    237     m_inspectorWebView = 0;
     235
     236    GRefPtr<WebKitWebInspector> webInspector = adoptGRef(m_webInspector.leakRef());
     237
     238    if (m_inspectorWebView) {
     239        g_signal_handlers_disconnect_by_func(m_inspectorWebView, reinterpret_cast<gpointer>(notifyWebViewDestroyed), this);
     240        m_inspectorWebView = 0;
     241    }
    238242
    239243    if (notifyInspectorController)
     
    244248
    245249    gboolean handled = FALSE;
    246     g_signal_emit_by_name(webInspector, "close-window", &handled);
     250    g_signal_emit_by_name(webInspector.get(), "close-window", &handled);
    247251    ASSERT(handled);
    248252
    249253    // Please do not use member variables here because InspectorFrontendClient object pointed by 'this'
    250254    // has been implicitly deleted by "close-window" function.
    251 
    252     /* we should now dispose our own reference */
    253     g_object_unref(webInspector);
    254255}
    255256
     
    275276
    276277    gboolean handled = FALSE;
    277     g_signal_emit_by_name(m_webInspector, "show-window", &handled);
     278    g_signal_emit_by_name(m_webInspector.get(), "show-window", &handled);
    278279}
    279280
     
    289290
    290291    gboolean handled = FALSE;
    291     g_signal_emit_by_name(m_webInspector, "attach-window", &handled);
     292    g_signal_emit_by_name(m_webInspector.get(), "attach-window", &handled);
    292293}
    293294
     
    298299
    299300    gboolean handled = FALSE;
    300     g_signal_emit_by_name(m_webInspector, "detach-window", &handled);
     301    g_signal_emit_by_name(m_webInspector.get(), "detach-window", &handled);
    301302}
    302303
     
    311312        return;
    312313
    313     webkit_web_inspector_set_inspected_uri(m_webInspector, newURL.utf8().data());
    314 }
    315 
    316 }
    317 
     314    webkit_web_inspector_set_inspected_uri(m_webInspector.get(), newURL.utf8().data());
     315}
     316
     317}
     318
  • trunk/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h

    r101201 r106831  
    3131
    3232#include "GOwnPtr.h"
     33#include "GRefPtr.h"
    3334#include "InspectorClient.h"
    3435#include "InspectorFrontendClientLocal.h"
     
    99100        WebKitWebView* m_inspectorWebView;
    100101        WebKitWebView* m_inspectedWebView;
    101         WebKitWebInspector* m_webInspector;
     102        GRefPtr<WebKitWebInspector> m_webInspector;
    102103        InspectorClient* m_inspectorClient;
    103104    };
Note: See TracChangeset for help on using the changeset viewer.