From f076ea2c8f3b1d4b7ff60d7ad02229baf36ae037 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 17 May 2010 17:00:07 +0200 Subject: Fix crashes on file:// urls --- src/protocolhandler.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 63bc640d..4a25ccd7 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -65,7 +65,7 @@ ProtocolHandler::ProtocolHandler(QObject *parent) : QObject(parent) - , _lister(0) + , _lister( new KDirLister(this) ) , _frame(0) { } @@ -73,6 +73,7 @@ ProtocolHandler::ProtocolHandler(QObject *parent) ProtocolHandler::~ProtocolHandler() { + delete _lister; } @@ -96,7 +97,7 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra if(scriptSource.isEmpty()) { // if javascript: then authority() returns // an empty string. Extract the source manually -// Use the prettyUrl() since that is unencoded + // Use the prettyUrl() since that is unencoded // 11 is length of 'javascript:' // fromPercentEncoding() is used to decode all the % encoded @@ -202,10 +203,6 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr QFileInfo fileInfo(_url.path()); if (fileInfo.isDir()) { - if(_lister) - delete _lister; - - _lister = new KDirLister(this); connect(_lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &))); _lister->openUrl(_url); @@ -234,8 +231,6 @@ void ProtocolHandler::showResults(const KFileItemList &list) Application::instance()->mainWindow()->currentTab()->setFocus(); Application::historyManager()->addHistoryEntry(_url.prettyUrl()); } - - delete _lister; } @@ -325,10 +320,6 @@ void ProtocolHandler::slotMostLocalUrlResult(KJob *job) KIO::UDSEntry entry = statJob->statResult(); if (entry.isDir()) { - if(_lister) - delete _lister; - - _lister = new KDirLister(this); connect(_lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &))); _lister->openUrl(_url); } -- cgit v1.2.1