Skip to content

Commit

Permalink
switch to QObject::isSignalConnected
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrolcl committed Dec 3, 2024
1 parent 95443b2 commit face722
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions library/alsa/alsaclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "errorcheck.h"
#include <QCoreApplication>
#include <QFile>
#include <QMetaMethod>
#include <QReadLocker>
#include <QRegularExpression>
#include <QThread>
#include <QWriteLocker>

#include <drumstick/alsaclient.h>
#include <drumstick/alsaevent.h>
#include <drumstick/alsaqueue.h>

#include "errorcheck.h"

#if defined(RTKIT_SUPPORT)
#include <QDBusConnection>
#include <QDBusInterface>
Expand Down Expand Up @@ -587,6 +590,7 @@ MidiClient::getSequencerType()
void
MidiClient::doEvents()
{
static const QMetaMethod receivedSignal = QMetaMethod::fromSignal(&MidiClient::eventReceived);
do {
int err = 0;
snd_seq_event_t* evp = nullptr;
Expand Down Expand Up @@ -688,7 +692,7 @@ MidiClient::doEvents()
}
} else {
// finally, process signals
if (receivers(SIGNAL(eventReceived(drumstick::ALSA::SequencerEvent *))) > 0) {
if (isSignalConnected(receivedSignal)) {
Q_EMIT eventReceived(event->clone());
}
}
Expand Down
6 changes: 4 additions & 2 deletions library/alsa/alsaport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <QMetaMethod>

#include "errorcheck.h"
#include <drumstick/alsaclient.h>
#include <drumstick/alsaqueue.h>
Expand Down Expand Up @@ -638,10 +640,10 @@ MidiPort::setMidiClient( MidiClient* seq )
void
MidiPort::subscribe(Subscription* subs)
{
static const QMetaMethod subscribedSignal = QMetaMethod::fromSignal(&MidiPort::subscribed);
subs->subscribe(m_MidiClient);
m_Subscriptions.append(*subs);
if (receivers(SIGNAL(subscribed(drumstick::ALSA::MidiPort *, drumstick::ALSA::Subscription *)))
> 0) {
if (isSignalConnected(subscribedSignal)) {
Q_EMIT subscribed(this, subs->clone());
}
}
Expand Down

0 comments on commit face722

Please sign in to comment.