Commit 0010ad23 authored by Thomas Eschenbacher's avatar Thomas Eschenbacher
Browse files

bugfix: Qt playback plugin crashed when stopping pre-listen

parent 5b42875a
* bugfix: cleanup code in destructor of PluginManager caused crash when
closing the window due to broken iterator
* bugfix: Qt playback plugin crashed when stopping pre-listen
20.03.70 [2020-02-16]
* dropped support for swap files, assuming that nowadays everyone has
much more than 4GB RAM and nobody really needs this. Additionally it
was a common pitfall that usage of physical memory was limited per
......@@ -9,8 +15,6 @@
* changed SAMPLE_INDEX_MAX to maximum value of a 32bit int (2.147.483.647)
* removed class MemoryManager, use Kwave::SampleArray directly as backend
for Kwave::Stripe (which reduces complexity a lot)
* bugfix: cleanup code in destructor of PluginManager caused crash when
closing the window due to broken iterator
19.07.70 [2019-03-16]
......
......@@ -47,6 +47,10 @@ Kwave::FilterPlugin::FilterPlugin(QObject *parent, const QVariantList &args)
//***************************************************************************
Kwave::FilterPlugin::~FilterPlugin()
{
if (m_sink) {
delete m_sink;
m_sink = Q_NULLPTR;
}
}
//***************************************************************************
......@@ -178,8 +182,10 @@ void Kwave::FilterPlugin::run(QStringList params)
// cleanup
if (filter) delete filter;
if (m_sink) delete m_sink;
m_sink = Q_NULLPTR;
if (!m_listen) {
delete m_sink;
m_sink = Q_NULLPTR;
}
if (undo_guard) delete undo_guard;
m_pause = false;
......@@ -222,6 +228,8 @@ void Kwave::FilterPlugin::stopPreListen()
stop();
m_listen = false;
setProgressDialogEnabled(true);
if (m_sink) delete m_sink;
m_sink = Q_NULLPTR;
}
//***************************************************************************
......
......@@ -30,6 +30,7 @@
#include <QAudioOutput>
#include <QObject>
#include <QSysInfo>
#include <QThread>
#include <KLocalizedString>
......@@ -45,7 +46,7 @@
//***************************************************************************
Kwave::PlayBackQt::PlayBackQt()
:QObject(), Kwave::PlayBackDevice(),
m_lock(QMutex::Recursive),
m_lock(QMutex::NonRecursive),
m_device_name_map(),
m_available_devices(),
m_output(Q_NULLPTR),
......@@ -175,7 +176,7 @@ QString Kwave::PlayBackQt::open(const QString &device, double rate,
if (!m_encoder) return i18n("Out of memory");
// create a new Qt output device
m_output = new(std::nothrow) QAudioOutput(format, this);
m_output = new(std::nothrow) QAudioOutput(format, 0);
Q_ASSERT(m_output);
if (!m_output) return i18n("Out of memory");
......@@ -340,8 +341,11 @@ int Kwave::PlayBackQt::close()
m_lock.lock();
}
delete m_output;
m_output = Q_NULLPTR;
if (m_output) {
// WARNING: QAudioOutput::~QAudioOutput() calls processEvents() !!!
m_output->deleteLater();
m_output = Q_NULLPTR;
}
delete m_encoder;
m_encoder = Q_NULLPTR;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment