From e433f472a765d738238a6b380060ce15c4910148 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Mon, 28 Sep 2009 17:27:19 +0200 Subject: Fix QWebHistory autotest crashes https://bugs.webkit.org/show_bug.cgi?id=29803 Reviewed-by: Simon Hausmann Cherry-picked-by: Simon Hausmann --- src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp index a6942a4..af27788 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp @@ -1491,9 +1491,11 @@ QWebPage::QWebPage(QObject *parent) */ QWebPage::~QWebPage() { - FrameLoader *loader = d->mainFrame->d->frame->loader(); - if (loader) - loader->detachFromParent(); + if (d->mainFrame) { + FrameLoader *loader = d->mainFrame->d->frame->loader(); + if (loader) + loader->detachFromParent(); + } if (d->inspector) d->inspector->setPage(0); delete d; @@ -1520,6 +1522,7 @@ QWebFrame *QWebPage::mainFrame() const */ QWebFrame *QWebPage::currentFrame() const { + d->createMainFrame(); return static_cast(d->page->focusController()->focusedOrMainFrame()->loader()->client())->webFrame(); } @@ -1545,6 +1548,7 @@ QWebFrame* QWebPage::frameAt(const QPoint& pos) const */ QWebHistory *QWebPage::history() const { + d->createMainFrame(); return &d->history; } -- cgit v0.12