mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 13:19:54 +02:00
cleanup Audio bg threads in cleanupBeforeQuit
This commit is contained in:
parent
cd2665fc55
commit
4a26785eda
3 changed files with 18 additions and 7 deletions
|
@ -1785,7 +1785,8 @@ void Application::cleanupBeforeQuit() {
|
||||||
|
|
||||||
// FIXME: something else is holding a reference to AudioClient,
|
// FIXME: something else is holding a reference to AudioClient,
|
||||||
// so it must be explicitly synchronously stopped here
|
// so it must be explicitly synchronously stopped here
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "stop", Qt::BlockingQueuedConnection);
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||||
|
"cleanupBeforeQuit", Qt::BlockingQueuedConnection);
|
||||||
|
|
||||||
// destroy Audio so it and its threads have a chance to go down safely
|
// destroy Audio so it and its threads have a chance to go down safely
|
||||||
// this must happen after QML, as there are unexplained audio crashes originating in qtwebengine
|
// this must happen after QML, as there are unexplained audio crashes originating in qtwebengine
|
||||||
|
|
|
@ -254,15 +254,24 @@ AudioClient::~AudioClient() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioClient::customDeleter() {
|
void AudioClient::customDeleter() {
|
||||||
stop(); // synchronously
|
deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
static_cast<BackgroundThread*>(_checkDevicesThread)->join();
|
void AudioClient::cleanupBeforeQuit() {
|
||||||
delete _checkDevicesThread;
|
// FIXME: this should be put in customDeleter, but there is still a reference to this when it is called,
|
||||||
|
// so this must be explicitly, synchronously stopped
|
||||||
|
|
||||||
static_cast<BackgroundThread*>(_localInjectorsThread)->join();
|
stop();
|
||||||
delete _localInjectorsThread;
|
|
||||||
|
|
||||||
deleteLater(); // asynchronously
|
if (_checkDevicesThread) {
|
||||||
|
static_cast<BackgroundThread*>(_checkDevicesThread)->join();
|
||||||
|
delete _checkDevicesThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_localInjectorsThread) {
|
||||||
|
static_cast<BackgroundThread*>(_localInjectorsThread)->join();
|
||||||
|
delete _localInjectorsThread;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioClient::handleMismatchAudioFormat(SharedNodePointer node, const QString& currentCodec, const QString& recievedCodec) {
|
void AudioClient::handleMismatchAudioFormat(SharedNodePointer node, const QString& currentCodec, const QString& recievedCodec) {
|
||||||
|
|
|
@ -158,6 +158,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void start();
|
void start();
|
||||||
void stop();
|
void stop();
|
||||||
|
void cleanupBeforeQuit();
|
||||||
|
|
||||||
void handleAudioEnvironmentDataPacket(QSharedPointer<ReceivedMessage> message);
|
void handleAudioEnvironmentDataPacket(QSharedPointer<ReceivedMessage> message);
|
||||||
void handleAudioDataPacket(QSharedPointer<ReceivedMessage> message);
|
void handleAudioDataPacket(QSharedPointer<ReceivedMessage> message);
|
||||||
|
|
Loading…
Reference in a new issue