Warning: QObject::connect(DockToolBar_QMLTYPE_2, WindowContent_QMLTYPE_0): unique connections require a pointer to member function of a QObject subclass #24716
Labels
P2
Priority: Medium
Qt-next
Either broken or fixed by (updating to) newer Qt versions than we currently use
regression MS3
Regression from MS3 (3.6.2)
tech debt
Issue type
Other type of issue
Description with steps to reproduce
This issue may be noticeable only with later Qt (I'm using 6.7.2), but it points that MuseScore is doing something explicitly prohibited in the Qt documentation (for any version), and since I've figured out the cause, I'll describe it here to help resolve it in the future.
When MuseScore starts and when I switch between scores, it prints:
This happens because
DockWindow::initDocks
usesQObject::connect
withQt::UniqueConnection
with a lambda:https://github.com/musescore/MuseScore/blame/v4.4.1/src/framework/dockwindow/view/dockwindow.cpp#L630-L640
However, documentation says that "Qt::UniqueConnections do not work for lambdas, non-member functions and functors; they only apply to connecting to member functions."
https://doc.qt.io/qt-6.2/qobject.html#connect-5
I have investigated this a bit and Qt::UniqueConnection seems to be needed here, otherwise connections keep piling up whenever I switch between scores.
This was added in #12431, /cc @RomanPudashkin
This warning was mentioned in #18689 (comment) but is not relevant to that issue (which I can not reproduce: I've checked that my MuseScore shows its menu in the global menu panel on Wayland).
Supporting files, videos and screenshots
What is the latest version of MuseScore Studio where this issue is present?
4.4.1
Regression
Yes, this used to work in MuseScore 3.x and now is broken
Operating system
NixOS
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: