summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-11-22 18:45:06 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-11-22 18:45:06 +0100
commitf0b2b230e1cd4d35f2a95c3bad94e31ecdd70de1 (patch)
tree2b5492ec5c976e75ec12f83e1e3d71989d3f0457
parentimprovements on urlbar (diff)
downloadrekonq-f0b2b230e1cd4d35f2a95c3bad94e31ecdd70de1.tar.xz
Fix some eventual crashes while clicking engine favicons
-rw-r--r--src/urlbar/completionwidget.cpp15
-rw-r--r--src/urlbar/listitem.cpp8
2 files changed, 15 insertions, 8 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index fc29f089..51ebd9e2 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -190,7 +190,7 @@ void CompletionWidget::clear()
QLayoutItem *child;
while ((child = layout()->takeAt(0)) != 0)
{
- delete child->widget();
+ child->widget()->deleteLater();
delete child;
}
_currentIndex = 0;
@@ -307,14 +307,16 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
}
}
- hide();
emit chosenUrl(urlToLoad, type);
kev->accept();
+ hide();
if (type != Rekonq::CurrentTab)
w->clear();
+
return true;
}
+
case Qt::Key_Escape:
hide();
@@ -348,14 +350,15 @@ void CompletionWidget::setVisible(bool visible)
void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button, Qt::KeyboardModifiers modifier)
{
- if (button == Qt::MidButton
- || modifier == Qt::ControlModifier)
+ KUrl u = item->url();
+
+ if (button == Qt::MidButton || modifier == Qt::ControlModifier)
{
- emit chosenUrl(item->url(), Rekonq::NewFocusedTab);
+ emit chosenUrl(u, Rekonq::NewFocusedTab);
}
else
{
- emit chosenUrl(item->url(), Rekonq::CurrentTab);
+ emit chosenUrl(u, Rekonq::CurrentTab);
}
// do it AFTER launching chosenUrl to get sure item exists
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index 95d8cbb9..a1e3315c 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -355,7 +355,6 @@ void SearchListItem::changeSearchEngine(KService::Ptr engine)
// create a new item && load it...
UrlSuggestionItem item = UrlSuggestionItem(UrlSuggestionItem::Search, SearchEngine::buildQuery(engine, text), text);
-
SearchListItem sItem(item, text, this);
emit itemClicked(&sItem, Qt::LeftButton, Qt::NoModifier);
}
@@ -402,7 +401,10 @@ KAction *EngineBar::newEngineAction(KService::Ptr engine, KService::Ptr selected
KAction *a = new KAction(IconManager::self()->engineFavicon(url), engine->name(), this);
a->setCheckable(true);
- if (engine->desktopEntryName() == selectedEngine->desktopEntryName()) a->setChecked(true);
+ if (engine->desktopEntryName() == selectedEngine->desktopEntryName())
+ {
+ a->setChecked(true);
+ }
a->setData(engine->entryPath());
connect(a, SIGNAL(triggered(bool)), this, SLOT(changeSearchEngine()));
return a;
@@ -412,6 +414,8 @@ KAction *EngineBar::newEngineAction(KService::Ptr engine, KService::Ptr selected
void EngineBar::changeSearchEngine()
{
KAction *a = qobject_cast<KAction*>(sender());
+ if (!a)
+ return;
emit searchEngineChanged(KService::serviceByDesktopPath(a->data().toString()));
}