Skip to content

Warning: QObject::connect(DockToolBar_QMLTYPE_2, WindowContent_QMLTYPE_0): unique connections require a pointer to member function of a QObject subclass #24716

@orivej

Description

@orivej

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:

WARN | main_thread | Qt | QObject::connect(DockToolBar_QMLTYPE_2, WindowContent_QMLTYPE_0): unique connections require a pointer to member function of a QObject subclass

This happens because DockWindow::initDocks uses QObject::connect with Qt::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

image

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

  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible

Metadata

Metadata

Assignees

Labels

P2Priority: MediumQt-nextEither broken or fixed by (updating to) newer Qt versions than we currently useregression MS3Regression from MS3 (3.6.2)tech debt

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions