Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cb680537 authored by Stefan Brüns's avatar Stefan Brüns

BookmarksRunner: Avoid multiple connections of identical signal

Summary:
The factory returns the same object when the browser name is not changed.
Connecting the signal again leads to multiple calls to the slot each
time the signal is emitted.

See also T9626

Test Plan:
1. Add some debug output to the teardown() slot
2. Open the krunner multiple times and enter some query
3. teardown() is called exactly once

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: davidedmundson, broulik, plasma-devel

Tags: #plasma

Maniphest Tasks: T9626

Differential Revision: https://phabricator.kde.org/D15306
parent 33746fa4
......@@ -60,8 +60,12 @@ BookmarksRunner::~BookmarksRunner()
void BookmarksRunner::prep()
{
m_browser = m_browserFactory->find(findBrowserName(), this);
connect(this, SIGNAL(teardown()), dynamic_cast<QObject*>(m_browser), SLOT(teardown()));
auto browser = m_browserFactory->find(findBrowserName(), this);
if (m_browser != browser) {
m_browser = browser;
connect(this, &Plasma::AbstractRunner::teardown,
dynamic_cast<QObject*>(m_browser), [this] () { m_browser->teardown(); });
}
m_browser->prepare();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment