Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
4 tasks done
orivej opened this issue Sep 14, 2024 · 0 comments · May be fixed by #25343 or #25016
Assignees
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

Comments

@orivej
Copy link
Contributor

orivej commented Sep 14, 2024

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
@muse-bot muse-bot added needs review The issue needs review to set priority, fix version or change status etc. regression MS3 Regression from MS3 (3.6.2) labels Sep 14, 2024
@cbjeukendrup cbjeukendrup added Qt-next Either broken or fixed by (updating to) newer Qt versions than we currently use and removed needs review The issue needs review to set priority, fix version or change status etc. labels Sep 14, 2024
@bkunda bkunda added the P2 Priority: Medium label Sep 17, 2024
@cbjeukendrup cbjeukendrup linked a pull request Oct 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: Next one or two releases
4 participants