From 138332c9f51c12ff6e11ebf80d80db793d93e034 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 20 Sep 2011 09:50:13 +0200 Subject: 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 --- src/urlbar/urlbar.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/urlbar') 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(); - } } -- cgit v1.2.1