1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Don't check for null pointer before deleting objects.

- as delete 0 is safe
This commit is contained in:
nowrep 2012-09-11 11:43:11 +02:00
parent 92b18f5466
commit 2d5b0c0bc0
7 changed files with 12 additions and 44 deletions

View File

@ -225,12 +225,7 @@ void CookieManager::addWhitelist()
void CookieManager::removeWhitelist() void CookieManager::removeWhitelist()
{ {
QListWidgetItem* current = ui->whiteList->currentItem(); delete ui->whiteList->currentItem();
if (!current) {
return;
}
delete current;
} }
void CookieManager::addBlacklist() void CookieManager::addBlacklist()
@ -245,12 +240,7 @@ void CookieManager::addBlacklist()
void CookieManager::removeBlacklist() void CookieManager::removeBlacklist()
{ {
QListWidgetItem* current = ui->blackList->currentItem(); delete ui->blackList->currentItem();
if (!current) {
return;
}
delete current;
} }
void CookieManager::deletePressed() void CookieManager::deletePressed()

View File

@ -113,9 +113,7 @@ void DownloadFileHelper::optionsDialogAccepted(int finish)
switch (finish) { switch (finish) {
case 0: // Cancelled case 0: // Cancelled
if (m_timer) {
delete m_timer; delete m_timer;
}
m_reply->abort(); m_reply->abort();
m_reply->deleteLater(); m_reply->deleteLater();
@ -144,9 +142,7 @@ void DownloadFileHelper::optionsDialogAccepted(int finish)
default: default:
qWarning() << "DownloadFileHelper::optionsDialogAccepted invalid return value!"; qWarning() << "DownloadFileHelper::optionsDialogAccepted invalid return value!";
if (m_timer) {
delete m_timer; delete m_timer;
}
m_reply->abort(); m_reply->abort();
m_reply->deleteLater(); m_reply->deleteLater();
@ -198,9 +194,7 @@ void DownloadFileHelper::fileNameChoosed(const QString &name, bool fileNameAutoG
m_reply->abort(); m_reply->abort();
m_reply->deleteLater(); m_reply->deleteLater();
if (m_timer) {
delete m_timer; delete m_timer;
}
return; return;
} }

View File

@ -163,10 +163,7 @@ void AcceptLanguage::addLanguage()
void AcceptLanguage::removeLanguage() void AcceptLanguage::removeLanguage()
{ {
QListWidgetItem* currentItem = ui->listWidget->currentItem(); delete ui->listWidget->currentItem();
if (currentItem) {
delete currentItem;
}
} }
void AcceptLanguage::upLanguage() void AcceptLanguage::upLanguage()

View File

@ -573,10 +573,8 @@ void Preferences::openSslManager()
void Preferences::showAcceptLanguage() void Preferences::showAcceptLanguage()
{ {
AcceptLanguage* a = new AcceptLanguage(this); AcceptLanguage a(this);
a->exec(); a.exec();
delete a;
} }
void Preferences::newTabChanged(int value) void Preferences::newTabChanged(int value)
@ -936,7 +934,5 @@ Preferences::~Preferences()
delete ui; delete ui;
delete m_autoFillManager; delete m_autoFillManager;
delete m_pluginsList; delete m_pluginsList;
if (m_notification) {
delete m_notification.data(); delete m_notification.data();
} }
}

View File

@ -65,12 +65,7 @@ void SSLManager::addPath()
void SSLManager::deletePath() void SSLManager::deletePath()
{ {
QListWidgetItem* currentItem = ui->pathList->currentItem(); delete ui->pathList->currentItem();
if (!currentItem) {
return;
}
delete currentItem;
} }
void SSLManager::refreshCAList() void SSLManager::refreshCAList()

View File

@ -290,7 +290,5 @@ void SiteInfo::securityDetailsClicked()
SiteInfo::~SiteInfo() SiteInfo::~SiteInfo()
{ {
delete ui; delete ui;
if (m_certWidget) {
delete m_certWidget; delete m_certWidget;
} }
}

View File

@ -322,7 +322,5 @@ void WebTab::disconnectObjects()
WebTab::~WebTab() WebTab::~WebTab()
{ {
if (m_locationBar) {
delete m_locationBar.data(); delete m_locationBar.data();
} }
}