From 490f88ffc2293cb0766d015984766e66e8c26bee Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 31 Oct 2011 21:27:52 +0100 Subject: [PATCH] Fixed crash + updated html highlighter Fixed crash when closing main window while there are still tabs loading and there are more than one QupZilla window --- src/app/qupzilla.cpp | 2 ++ src/app/qupzilla.h | 3 +++ src/autofill/autofillmodel.cpp | 5 +++-- src/navigation/navigationbar.cpp | 2 +- src/tools/htmlhighlighter.cpp | 2 +- src/webview/webview.cpp | 4 ++-- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/qupzilla.cpp b/src/app/qupzilla.cpp index 73a804dd5..3891336eb 100644 --- a/src/app/qupzilla.cpp +++ b/src/app/qupzilla.cpp @@ -86,6 +86,7 @@ QupZilla::QupZilla(bool tryRestore, QUrl startUrl) , m_tryRestore(tryRestore) , m_historyMenuChanged(true) , m_bookmarksMenuChanged(true) + , m_isClosing(false) , m_startingUrl(startUrl) , m_actionPrivateBrowsing(0) , m_webInspectorDock(0) @@ -1094,6 +1095,7 @@ void QupZilla::closeEvent(QCloseEvent* event) if (mApp->isClosing()) return; + m_isClosing = true; mApp->saveStateSlot(); mApp->aboutToCloseWindow(this); diff --git a/src/app/qupzilla.h b/src/app/qupzilla.h index fe23974ed..1cb4de1bd 100644 --- a/src/app/qupzilla.h +++ b/src/app/qupzilla.h @@ -106,6 +106,8 @@ public: inline QAction* actionRestoreTab() { return m_actionRestoreTab; } inline QMenu* superMenu() { return m_superMenu; } + inline bool isClosing() { return m_isClosing; } + signals: void loadHistory(); void startingCompleted(); @@ -196,6 +198,7 @@ private: bool m_tryRestore; bool m_historyMenuChanged; bool m_bookmarksMenuChanged; + bool m_isClosing; QUrl m_startingUrl; QUrl m_newtab; QUrl m_homepage; diff --git a/src/autofill/autofillmodel.cpp b/src/autofill/autofillmodel.cpp index 33f545de5..698958eea 100644 --- a/src/autofill/autofillmodel.cpp +++ b/src/autofill/autofillmodel.cpp @@ -176,6 +176,7 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo QString passwordName = ""; QString passwordValue = ""; + QUrl siteUrl = webView->url(); QWebElementCollection inputs; QList frames; @@ -194,13 +195,13 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo } //Return if storing is not enabled, data for this page is already stored, no password element found in sent data - if (passwordName.isEmpty() || !isStoringEnabled(request.url()) || isStored(request.url())) + if (passwordName.isEmpty() || !isStoringEnabled(siteUrl) || isStored(siteUrl)) return; //Return if no password form has been sent if (!outgoingData.contains((QUrl(passwordName).toEncoded() + "=")) || passwordValue.isEmpty()) return; - AutoFillNotification* aWidget = new AutoFillNotification(webView->url(), outgoingData, passwordValue); + AutoFillNotification* aWidget = new AutoFillNotification(siteUrl, outgoingData, passwordValue); webView->addNotification(aWidget); } diff --git a/src/navigation/navigationbar.cpp b/src/navigation/navigationbar.cpp index 63eb37b0f..93989e2f9 100644 --- a/src/navigation/navigationbar.cpp +++ b/src/navigation/navigationbar.cpp @@ -221,7 +221,7 @@ void NavigationBar::goAtHistoryIndex() void NavigationBar::refreshHistory() { - if (mApp->isClosing()) + if (mApp->isClosing() || p_QupZilla->isClosing()) return; QWebHistory* history = p_QupZilla->weView()->page()->history(); diff --git a/src/tools/htmlhighlighter.cpp b/src/tools/htmlhighlighter.cpp index 8d3381368..fa4047a0a 100644 --- a/src/tools/htmlhighlighter.cpp +++ b/src/tools/htmlhighlighter.cpp @@ -117,7 +117,7 @@ << "allowscriptaccess=\"" << "cols=\"" << "rows=\"" << "profile=\"" << "colspan=\"" << "scope=\"" << "data=\"" << "autoplay=\"" << "hspace=\"" - << "valign=\"" << "vspace=\"" + << "valign=\"" << "vspace=\"" << "controls=\"" << "href=\"" << "title=\"" << "xmlns=\""; foreach (const QString &pattern, optionsPatterns) { rule.pattern = QRegExp(pattern); diff --git a/src/webview/webview.cpp b/src/webview/webview.cpp index 3881042f9..be03a8435 100644 --- a/src/webview/webview.cpp +++ b/src/webview/webview.cpp @@ -248,7 +248,7 @@ void WebView::loadFinished(bool state) { Q_UNUSED(state); - if (mApp->isClosing()) + if (mApp->isClosing() || p_QupZilla->isClosing()) return; if (animationLoading(tabIndex(), false)->movie()) @@ -296,7 +296,7 @@ void WebView::titleChanged() void WebView::iconChanged() { - if (mApp->isClosing()) + if (mApp->isClosing() || p_QupZilla->isClosing()) return; // if (isCurrent())