1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Fixed crash when cleaning cache while cache is not used (disabled).

This commit is contained in:
nowrep 2012-06-15 17:43:19 +02:00
parent 0cba7628de
commit 8f75fd2532
12 changed files with 32 additions and 26 deletions

View File

@ -58,7 +58,7 @@ extern "C" {
IObjectArray : public IUnknown {
public:
virtual HRESULT STDMETHODCALLTYPE GetCount(
/* [out] */ __RPC__out UINT* pcObjects) = 0;
/* [out] */ __RPC__out UINT * pcObjects) = 0;
virtual HRESULT STDMETHODCALLTYPE GetAt(
/* [in] */ UINT uiIndex,
@ -82,10 +82,10 @@ IObjectArray : public IUnknown {
IObjectCollection : public IObjectArray {
public:
virtual HRESULT STDMETHODCALLTYPE AddObject(
/* [in] */ __RPC__in_opt IUnknown* punk) = 0;
/* [in] */ __RPC__in_opt IUnknown * punk) = 0;
virtual HRESULT STDMETHODCALLTYPE AddFromArray(
/* [in] */ __RPC__in_opt IObjectArray* poaSource) = 0;
/* [in] */ __RPC__in_opt IObjectArray * poaSource) = 0;
virtual HRESULT STDMETHODCALLTYPE RemoveObjectAt(
/* [in] */ UINT uiIndex) = 0;
@ -132,19 +132,19 @@ public:
/* [string][in] */ __RPC__in_string LPCWSTR pszAppID) = 0;
virtual HRESULT STDMETHODCALLTYPE BeginList(
/* [out] */ __RPC__out UINT* pcMinSlots,
/* [out] */ __RPC__out UINT * pcMinSlots,
/* [in] */ __RPC__in REFIID riid,
/* [iid_is][out] */ __RPC__deref_out_opt void** ppv) = 0;
virtual HRESULT STDMETHODCALLTYPE AppendCategory(
/* [string][in] */ __RPC__in_string LPCWSTR pszCategory,
/* [in] */ __RPC__in_opt IObjectArray* poa) = 0;
/* [in] */ __RPC__in_opt IObjectArray * poa) = 0;
virtual HRESULT STDMETHODCALLTYPE AppendKnownCategory(
/* [in] */ KNOWNDESTCATEGORY category) = 0;
virtual HRESULT STDMETHODCALLTYPE AddUserTasks(
/* [in] */ __RPC__in_opt IObjectArray* poa) = 0;
/* [in] */ __RPC__in_opt IObjectArray * poa) = 0;
virtual HRESULT STDMETHODCALLTYPE CommitList(void) = 0;
@ -311,7 +311,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip(
/* [in] */ __RPC__in HWND hwnd,
/* [in] */ __RPC__in RECT* prcClip) = 0;
/* [in] */ __RPC__in RECT * prcClip) = 0;
};
#endif //_MSC_VER >= 1500 && _MSC_VER < 1600

View File

@ -93,7 +93,7 @@ AdBlockPage* AdBlockManager::page()
return m_adBlockPage;
}
AdBlockSubscription *AdBlockManager::subscription()
AdBlockSubscription* AdBlockManager::subscription()
{
return m_subscriptions.at(0);
}
@ -109,7 +109,7 @@ QNetworkReply* AdBlockManager::block(const QNetworkRequest &request)
const AdBlockRule* blockedRule = 0;
foreach (AdBlockSubscription* subscription, m_subscriptions) {
foreach(AdBlockSubscription * subscription, m_subscriptions) {
if (subscription->allow(urlString)) {
return 0;
}

View File

@ -76,7 +76,7 @@ MainApplication::MainApplication(int &argc, char** argv)
, m_bookmarksModel(0)
, m_downloadManager(0)
, m_autofill(0)
, m_networkCache(new QNetworkDiskCache(this))
, m_networkCache(0)
, m_desktopNotifications(0)
, m_searchEnginesManager(0)
, m_dbWriter(new DatabaseWriter(this))
@ -712,6 +712,16 @@ SearchEnginesManager* MainApplication::searchEnginesManager()
return m_searchEnginesManager;
}
QNetworkDiskCache* MainApplication::networkCache()
{
if (!m_networkCache) {
m_networkCache = new QNetworkDiskCache(this);
m_networkCache->setCacheDirectory(m_activeProfil + "/networkcache");
}
return m_networkCache;
}
DesktopNotificationsFactory* MainApplication::desktopNotifications()
{
if (!m_desktopNotifications) {

View File

@ -93,7 +93,7 @@ public:
DownloadManager* downManager();
AutoFillModel* autoFill();
SearchEnginesManager* searchEnginesManager();
QNetworkDiskCache* networkCache() { return m_networkCache; }
QNetworkDiskCache* networkCache();
DesktopNotificationsFactory* desktopNotifications();
DatabaseWriter* dbWriter() { return m_dbWriter; }

View File

@ -279,7 +279,7 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
}
foreach(const QWebElement & formElement, allForms) {
foreach(const QWebElement &inputElement, formElement.findAll("input[type=\"password\"]")) {
foreach(const QWebElement & inputElement, formElement.findAll("input[type=\"password\"]")) {
passwordName = inputElement.attribute("name");
passwordValue = getValueFromData(data, inputElement);
@ -302,7 +302,7 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
// We need to find username, we suppose that username is first not empty input[type=text] in form
// Tell me better solution. Maybe first try to find name="user", name="username" ?
foreach(const QWebElement &element, foundForm.findAll("input[type=\"text\"]")) {
foreach(const QWebElement & element, foundForm.findAll("input[type=\"text\"]")) {
usernameName = element.attribute("name");
usernameValue = getValueFromData(data, element);
if (!usernameName.isEmpty() && !usernameValue.isEmpty()) {

View File

@ -147,7 +147,7 @@ void CookieManager::refreshTable()
void CookieManager::slotRefreshTable()
{
const QList<QNetworkCookie>& allCookies = mApp->cookieJar()->getAllCookies();
const QList<QNetworkCookie> &allCookies = mApp->cookieJar()->getAllCookies();
QApplication::setOverrideCursor(Qt::WaitCursor);
ui->cookieTree->clear();

View File

@ -67,7 +67,7 @@ NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent)
connect(this, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), this, SLOT(sslError(QNetworkReply*, QList<QSslError>)));
connect(this, SIGNAL(finished(QNetworkReply*)), this, SLOT(setSSLConfiguration(QNetworkReply*)));
m_schemeHandlers["qupzilla"] = new QupZillaSchemeHandler;
m_schemeHandlers["qupzilla"] = new QupZillaSchemeHandler();
m_proxyFactory = new NetworkProxyFactory();
setProxyFactory(m_proxyFactory);
@ -80,10 +80,9 @@ void NetworkManager::loadSettings()
settings.beginGroup("Web-Browser-Settings");
if (settings.value("AllowLocalCache", true).toBool()) {
m_diskCache = mApp->networkCache();
m_diskCache->setCacheDirectory(mApp->currentProfilePath() + "/networkcache");
m_diskCache->setMaximumCacheSize(settings.value("MaximumCacheSize", 50).toInt() * 1024 * 1024); //MegaBytes
setCache(m_diskCache);
QNetworkDiskCache* cache = mApp->networkCache();
cache->setMaximumCacheSize(settings.value("MaximumCacheSize", 50).toInt() * 1024 * 1024); //MegaBytes
setCache(cache);
}
m_doNotTrack = settings.value("DoNotTrack", false).toBool();
m_sendReferer = settings.value("SendReferer", true).toBool();

View File

@ -24,8 +24,6 @@
#include "qz_namespace.h"
#include "networkmanagerproxy.h"
class QNetworkDiskCache;
class QupZilla;
class AdBlockManager;
class NetworkProxyFactory;
@ -72,7 +70,6 @@ private slots:
private:
AdBlockManager* m_adblockManager;
QupZilla* p_QupZilla;
QNetworkDiskCache* m_diskCache;
NetworkProxyFactory* m_proxyFactory;
QStringList m_certPaths;

View File

@ -39,7 +39,7 @@ void NetworkManagerProxy::setPrimaryNetworkAccessManager(NetworkManager* manager
connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), m_manager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)));
connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator*)), m_manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy, QAuthenticator*)));
connect(this, SIGNAL(finished(QNetworkReply*)), m_manager, SIGNAL(finished(QNetworkReply*)));
connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), m_manager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)));
connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> &)), m_manager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> &)));
}
QNetworkReply* NetworkManagerProxy::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData)

View File

@ -77,8 +77,8 @@ void ClearPrivateData::clearWebDatabases()
void ClearPrivateData::clearCache()
{
mApp->networkCache()->clear();
mApp->webSettings()->clearMemoryCaches();
mApp->networkManager()->cache()->clear();
QFile::remove(mApp->currentProfilePath() + "ApplicationCache.db");
}

View File

@ -277,7 +277,7 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
if (position == -1 && m_newTabAfterActive && !(openFlags & Qz::NT_TabAtTheEnd)) {
// If we are opening newBgTab from pinned tab, make sure it won't be
// opened between other pinned tabs
if (openFlags &Qz::NT_NotSelectedTab && m_lastBackgroundTabIndex != -1) {
if (openFlags & Qz::NT_NotSelectedTab && m_lastBackgroundTabIndex != -1) {
position = m_lastBackgroundTabIndex + 1;
}
else {

View File

@ -118,7 +118,7 @@ void MouseGestureRecognizer::addPoint(int x, int y)
dx = x - d->positions.back().x;
dy = y - d->positions.back().y;
if (dx* dx + dy* dy >= d->minimumMovement2) {
if (dx * dx + dy * dy >= d->minimumMovement2) {
d->positions.push_back(Pos(x, y));
}
}