summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-09-20 09:50:13 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-09-20 09:50:13 +0200
commit138332c9f51c12ff6e11ebf80d80db793d93e034 (patch)
treef4fa947f7c3705e95ccbf0968026d522e6ae9e0c
parentLicensing issues fix: part #2 (diff)
downloadrekonq-138332c9f51c12ff6e11ebf80d80db793d93e034.tar.xz
QCoreApplication::postEvent fixes
This commit should clean up some strange calls on close to QCA::postEvent, returning a strange "Unexpected null receiver" QT_FATAL_WARNINGS=1 macro helped very well here :D
-rw-r--r--src/urlbar/urlbar.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 04e48d1b..ed00c84c 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -433,24 +433,22 @@ void UrlBar::loadTyped(const QString &text)
void UrlBar::activateSuggestions(bool b)
{
- if (b)
+ if (b && _box.isNull())
{
- if (_box.isNull())
- {
- _box = new CompletionWidget(this);
- installEventFilter(_box.data());
- connect(_box.data(), SIGNAL(chosenUrl(const KUrl &, Rekonq::OpenType)), this, SLOT(activated(const KUrl &, Rekonq::OpenType)));
+ _box = new CompletionWidget(this);
+ installEventFilter(_box.data());
+ connect(_box.data(), SIGNAL(chosenUrl(const KUrl &, Rekonq::OpenType)), this, SLOT(activated(const KUrl &, Rekonq::OpenType)));
- // activate suggestions on edit text
- connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &)));
- }
+ // activate suggestions on edit text
+ connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &)));
+
+ return;
}
- else
- {
- disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &)));
- removeEventFilter(_box.data());
+
+ disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(detectTypedString(const QString &)));
+ removeEventFilter(_box.data());
+ if (!_box.isNull())
_box.data()->deleteLater();
- }
}