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
broulik |
Plasma |
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
No Linters Available |
No Unit Test Coverage |
Buildable 2562 | |
Build 2580: arc lint + arc unit |
Can't you connect to the slot directly and use Qt::UniqueConnection?
runners/bookmarks/bookmarksrunner.cpp | ||
---|---|---|
66 | Please provide this as context. |
runners/bookmarks/bookmarksrunner.cpp | ||
---|---|---|
65 | do we not also need a disconnect on m_browser? |
runners/bookmarks/bookmarksrunner.cpp | ||
---|---|---|
66 | No, four-argument connect: connect(this, &..., this, .... Though you just connect from this anyway, so I guess this isn't needed |
runners/bookmarks/bookmarksrunner.cpp | ||
---|---|---|
66 | Hm, just found that auto-disconnect (see @davidedmundson s comment) only works if you provide a context. The context has to be m_browser here. |
runners/bookmarks/bookmarksrunner.cpp | ||
---|---|---|
66 | Ah, yeah, right, and then you could connect direcftly: connect(this, &Plasma::AbstractRunner:teardown, m_browser, &Browser::teardown); |
runners/bookmarks/bookmarksrunner.cpp | ||
---|---|---|
66 | yes, after readding the dynamic_cast<QObject*>, m_browser is a non-QObject interface class. |
runners/bookmarks/bookmarksrunner.cpp | ||
---|---|---|
66 | The only syntax which works is connect(this, &Plasma::AbstractRunner:teardown, dynamic_cast<QObject*>(m_browser), [this] () { m_browser->teardown(); }); The context object has to be a QObject* (or derived). The other approach would be to make Browser a QObject derived class. |