1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +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()
{
QListWidgetItem* current = ui->whiteList->currentItem();
if (!current) {
return;
}
delete current;
delete ui->whiteList->currentItem();
}
void CookieManager::addBlacklist()
@ -245,12 +240,7 @@ void CookieManager::addBlacklist()
void CookieManager::removeBlacklist()
{
QListWidgetItem* current = ui->blackList->currentItem();
if (!current) {
return;
}
delete current;
delete ui->blackList->currentItem();
}
void CookieManager::deletePressed()

View File

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

View File

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

View File

@ -573,10 +573,8 @@ void Preferences::openSslManager()
void Preferences::showAcceptLanguage()
{
AcceptLanguage* a = new AcceptLanguage(this);
a->exec();
delete a;
AcceptLanguage a(this);
a.exec();
}
void Preferences::newTabChanged(int value)
@ -936,7 +934,5 @@ Preferences::~Preferences()
delete ui;
delete m_autoFillManager;
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()
{
QListWidgetItem* currentItem = ui->pathList->currentItem();
if (!currentItem) {
return;
}
delete currentItem;
delete ui->pathList->currentItem();
}
void SSLManager::refreshCAList()

View File

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

View File

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