Commit eb1ba75c authored by zecke@webkit.org's avatar zecke@webkit.org

* Make sure that the WebCore::Frame is living as long as the WebKitWebFrame

  wrapped around it. All current calls to WebCore::Frame from within the
  WebKitWebFrame are safe, even in the case where the WebCore::Frame is already
  detached from the WebCore::Page.
* For the mainFrame the WebKitWebView is holding the initial reference and
  will unref on destruction.
* For sub-frames the FramerLoaderClientGtk.cpp will do the unrefing when the
  frame gets detached from the parent.
* Make sure FrameLoader::detachFromParent gets called by calling FrameLoader::detachChildren


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30226 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3779a432
2008-02-14 Holger Hans Peter Freyther <holger.freyther@trolltech.com>
Reviewed by Alp.
* Make sure that the WebCore::Frame is living as long as the WebKitWebFrame
wrapped around it. All current calls to WebCore::Frame from within the
WebKitWebFrame are safe, even in the case where the WebCore::Frame is already
detached from the WebCore::Page.
* For the mainFrame the WebKitWebView is holding the initial reference and
will unref on destruction.
* For sub-frames the FramerLoaderClientGtk.cpp will do the unrefing when the
frame gets detached from the parent.
* Make sure FrameLoader::detachFromParent gets called by calling FrameLoader::detachChildren
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::detachedFromParent4):
* webkit/webkitprivate.cpp:
(WebKit::core):
* webkit/webkitprivate.h:
* webkit/webkitwebframe.cpp:
* webkit/webkitwebview.cpp:
2008-02-14 Holger Hans Peter Freyther <holger.freyther@trolltech.com>
Reviewed by Alp.
......
......@@ -452,7 +452,9 @@ void FrameLoaderClient::detachedFromParent3()
void FrameLoaderClient::detachedFromParent4()
{
notImplemented();
ASSERT(m_frame);
g_object_unref(m_frame);
m_frame = 0;
}
void FrameLoaderClient::loadedFromCachedPage()
......
......@@ -49,7 +49,7 @@ WebCore::Frame* core(WebKitWebFrame* frame)
return 0;
WebKitWebFramePrivate* priv = frame->priv;
return priv ? priv->coreFrame : 0;
return priv ? priv->coreFrame.get() : 0;
}
WebKitWebFrame* kit(WebCore::Frame* coreFrame)
......
......@@ -89,7 +89,7 @@ extern "C" {
#define WEBKIT_WEB_FRAME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate))
typedef struct _WebKitWebFramePrivate WebKitWebFramePrivate;
struct _WebKitWebFramePrivate {
WebCore::Frame* coreFrame;
WTF::RefPtr<WebCore::Frame> coreFrame;
WebCore::FrameLoaderClient* client;
WebKitWebView* webView;
......
......@@ -93,6 +93,8 @@ static void webkit_web_frame_finalize(GObject* object)
WebKitWebFramePrivate* priv = frame->priv;
priv->coreFrame->loader()->cancelAndClear();
priv->coreFrame = 0;
g_free(priv->name);
g_free(priv->title);
g_free(priv->uri);
......@@ -216,7 +218,7 @@ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView)
priv->client = new WebKit::FrameLoaderClient(frame);
priv->coreFrame = new Frame(viewPriv->corePage, 0, priv->client);
FrameView* frameView = new FrameView(priv->coreFrame);
FrameView* frameView = new FrameView(priv->coreFrame.get());
frameView->setContainingWindow(GTK_CONTAINER(webView));
frameView->setGtkAdjustments(GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)),
GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)));
......@@ -237,7 +239,7 @@ WebKitWebFrame* webkit_web_frame_init_with_web_view(WebKitWebView* webView, HTML
priv->client = new WebKit::FrameLoaderClient(frame);
priv->coreFrame = new Frame(viewPriv->corePage, element, priv->client);
FrameView* frameView = new FrameView(priv->coreFrame);
FrameView* frameView = new FrameView(priv->coreFrame.get());
frameView->setContainingWindow(GTK_CONTAINER(webView));
priv->coreFrame->setView(frameView);
frameView->deref();
......
......@@ -612,6 +612,7 @@ static void webkit_web_view_finalize(GObject* object)
webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object));
core(priv->mainFrame)->loader()->detachChildren();
delete priv->corePage;
g_object_unref(priv->backForwardList);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment