Skip to content

Commit da05efb

Browse files
committed
Fix initialization order in EngineMixer to fix a segfault during shutdown.
1 parent b83a4d9 commit da05efb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/engine/enginemixer.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@ class EngineMixer : public QObject, public AudioSource {
264264
// non-owning. lifetime bound to EffectsManager
265265
EngineEffectsManager* m_pEngineEffectsManager;
266266

267-
// List of channels added to the engine.
268-
QVarLengthArray<std::unique_ptr<ChannelInfo>, kPreallocatedChannels> m_channels;
269-
270267
// The previous gain of each channel for each mixing output (main,
271268
// headphone, talkover).
272269
QVarLengthArray<GainCache, kPreallocatedChannels> m_channelMainGainCache;
@@ -345,4 +342,8 @@ class EngineMixer : public QObject, public AudioSource {
345342
// TODO (Swiftb0y): remove volatile (probably supposed to be std::atomic instead).
346343
volatile bool m_bBusOutputConnected[3];
347344
bool m_bExternalRecordBroadcastInputConnected;
345+
346+
// Owning list of channels added to the engine.
347+
// Keep at last position, it needs to be destroyed first
348+
QVarLengthArray<std::unique_ptr<ChannelInfo>, kPreallocatedChannels> m_channels;
348349
};

0 commit comments

Comments
 (0)