WebPage: Remove isPointerSafeToUse hack

Pointers are no longer stored as void* in network requests
remotes/origin/falkon
David Rosca 11 years ago
parent b9d5851ef5
commit a672771cef
  1. 2
      src/lib/adblock/adblockmanager.cpp
  2. 14
      src/lib/webengine/webpage.cpp
  3. 3
      src/lib/webengine/webpage.h

@ -102,7 +102,7 @@ QNetworkReply* AdBlockManager::block(const QNetworkRequest &request)
if (blockedRule) {
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
WebPage* webPage = static_cast<WebPage*>(v.value<void*>());
if (WebPage::isPointerSafeToUse(webPage)) {
if (webPage) {
if (!canBeBlocked(webPage->url())) {
return 0;
}

@ -70,7 +70,6 @@
QString WebPage::s_lastUploadLocation = QDir::homePath();
QUrl WebPage::s_lastUnsupportedUrl;
QTime WebPage::s_lastUnsupportedUrlTime;
QList<WebPage*> WebPage::s_livingPages;
QStringList WebPage::s_ignoredSslErrors;
WebPage::WebPage(QObject* parent)
@ -120,8 +119,6 @@ WebPage::WebPage(QObject* parent)
#endif
#endif
s_livingPages.append(this);
}
WebPage::~WebPage()
@ -132,8 +129,6 @@ WebPage::~WebPage()
m_runningLoop->exit(1);
m_runningLoop = 0;
}
s_livingPages.removeOne(this);
}
void WebPage::setWebView(TabbedWebView* view)
@ -1265,12 +1260,3 @@ QWebEnginePage* WebPage::createWindow(QWebEnginePage::WebWindowType type)
return 0;
}
}
bool WebPage::isPointerSafeToUse(WebPage* page)
{
// Pointer to WebPage is passed with every QNetworkRequest casted to void*
// So there is no way to test whether pointer is still valid or not, except
// this hack.
return page == 0 ? false : s_livingPages.contains(page);
}

@ -83,8 +83,6 @@ public:
#endif
QString userAgentForUrl(const QUrl &url) const;
static bool isPointerSafeToUse(WebPage* page);
signals:
void privacyChanged(bool status);
@ -138,7 +136,6 @@ private:
static QString s_lastUploadLocation;
static QUrl s_lastUnsupportedUrl;
static QTime s_lastUnsupportedUrlTime;
static QList<WebPage*> s_livingPages;
static QStringList s_ignoredSslErrors;
NetworkManagerProxy* m_networkProxy;

Loading…
Cancel
Save