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

disconnect SLOT(handleChannelMessageQueue) #1634

Closed
srcejon opened this issue Mar 20, 2023 · 1 comment
Closed

disconnect SLOT(handleChannelMessageQueue) #1634

srcejon opened this issue Mar 20, 2023 · 1 comment
Assignees

Comments

@srcejon
Copy link
Collaborator

srcejon commented Mar 20, 2023

In afc.cpp and and demodanalyzer.cpp we have:

            disconnect(messageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleChannelMessageQueue(MessageQueue*)));

However, I don't think this will work as intended, as a lambda is what is connected to, not handleChannelMessageQueue:

            QObject::connect(
                messageQueue,
                &MessageQueue::messageEnqueued,
                this,
                [=](){ this->handleChannelMessageQueue(messageQueue); },
                Qt::QueuedConnection
            );

If c++ syntax is used for the disconnect, it fails to compile.

Should be able to disconnect everything by passing nullptr instead, or I think need to save the return value from connect and use that for the disconnect.

edit: Just realised this is the same type of problem as #1620

@f4exb
Copy link
Owner

f4exb commented Mar 20, 2023

Yes to disconnect a connect done with a lambda one should use nullptr for the slot reference. This is not very obvious and I discovered it in #1620 indeed.

@f4exb f4exb self-assigned this Mar 23, 2023
@f4exb f4exb closed this as completed in a3a62a6 Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants