Skip to content

Commit

Permalink
Fix crash when removing channels
Browse files Browse the repository at this point in the history
Sometimes the application could crash when deleting a channel because it
would still be used when the method returned.

This commit makes the channel be deleted only after the stack returns to
the event loop.

Fixes LMMS#1679
  • Loading branch information
badosu committed Jan 28, 2015
1 parent 8e2e17a commit 9e35e6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion include/FxMixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef FX_MIXER_H
#define FX_MIXER_H

#include <QObject>

#include "Model.h"
#include "Mixer.h"
#include "EffectChain.h"
Expand All @@ -35,7 +37,7 @@
class FxRoute;
typedef QVector<FxRoute *> FxRouteVector;

class FxChannel : public ThreadableJob
class FxChannel : public ThreadableJob, public QObject
{
public:
FxChannel( int idx, Model * _parent );
Expand Down
2 changes: 1 addition & 1 deletion src/core/FxMixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void FxMixer::deleteChannel( int index )
}

// actually delete the channel
delete m_fxChannels[index];
m_fxChannels[index]->deleteLater();
m_fxChannels.remove(index);

for( int i = index; i < m_fxChannels.size(); ++i )
Expand Down

0 comments on commit 9e35e6d

Please sign in to comment.