[vlc-commits] qt: fix crash when player has no audio output module
Pierre Lamot
git at videolan.org
Mon Sep 30 09:33:38 CEST 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Mon Sep 2 14:17:48 2019 +0200| [c83a81794c3f974953356b97a8473a61872647dc] | committer: Thomas Guillem
qt: fix crash when player has no audio output module
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c83a81794c3f974953356b97a8473a61872647dc
---
modules/gui/qt/components/audio_device_model.cpp | 8 ++++----
modules/gui/qt/components/audio_device_model.hpp | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/gui/qt/components/audio_device_model.cpp b/modules/gui/qt/components/audio_device_model.cpp
index cb2b9bfdf4..272e429128 100644
--- a/modules/gui/qt/components/audio_device_model.cpp
+++ b/modules/gui/qt/components/audio_device_model.cpp
@@ -46,8 +46,8 @@ AudioDeviceModel::AudioDeviceModel(vlc_player_t *player, QObject *parent)
}
m_aout = vlc_player_aout_Hold(m_player);
-
- m_inputs = aout_DevicesList(m_aout, &m_ids, &m_names);
+ if (m_aout)
+ m_inputs = aout_DevicesList(m_aout, &m_ids, &m_names);
}
AudioDeviceModel::~AudioDeviceModel()
@@ -66,8 +66,8 @@ AudioDeviceModel::~AudioDeviceModel()
vlc_player_locker locker{m_player};
vlc_player_aout_RemoveListener(m_player, m_player_aout_listener);
- aout_Release(m_aout);
-
+ if (m_aout)
+ aout_Release(m_aout);
}
Qt::ItemFlags AudioDeviceModel::flags(const QModelIndex &) const
diff --git a/modules/gui/qt/components/audio_device_model.hpp b/modules/gui/qt/components/audio_device_model.hpp
index 1721990d5e..3b5fb6d419 100644
--- a/modules/gui/qt/components/audio_device_model.hpp
+++ b/modules/gui/qt/components/audio_device_model.hpp
@@ -52,7 +52,7 @@ public:
QHash<int, QByteArray> roleNames() const override;
private:
- int m_inputs;
+ int m_inputs = 0;
char **m_names;
char **m_ids;
QString m_current;
More information about the vlc-commits
mailing list