diff --git a/src/multimedia/audio/qaudioprobe.cpp b/src/multimedia/audio/qaudioprobe.cpp index 6dd7d725..8e7aed4a 100644 --- a/src/multimedia/audio/qaudioprobe.cpp +++ b/src/multimedia/audio/qaudioprobe.cpp @@ -125,6 +125,14 @@ bool QAudioProbe::setSource(QMediaObject *source) // 1) disconnect from current source if necessary // 2) see if new one has the probe control // 3) connect if so + + // in case source was destroyed but probe control is still valid + if (!d->source && d->probee) { + disconnect(d->probee.data(), SIGNAL(audioBufferProbed(QAudioBuffer)), this, SIGNAL(audioBufferProbed(QAudioBuffer))); + disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); + d->probee.clear(); + } + if (source != d->source.data()) { if (d->source) { Q_ASSERT(d->probee); diff --git a/src/multimedia/video/qvideoprobe.cpp b/src/multimedia/video/qvideoprobe.cpp index 21e658c6..0417a233 100644 --- a/src/multimedia/video/qvideoprobe.cpp +++ b/src/multimedia/video/qvideoprobe.cpp @@ -130,6 +130,14 @@ bool QVideoProbe::setSource(QMediaObject *source) // 1) disconnect from current source if necessary // 2) see if new one has the probe control // 3) connect if so + + // in case source was destroyed but probe control is still valid + if (!d->source && d->probee) { + disconnect(d->probee.data(), SIGNAL(videoFrameProbed(QVideoFrame)), this, SIGNAL(videoFrameProbed(QVideoFrame))); + disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); + d->probee.clear(); + } + if (source != d->source.data()) { if (d->source) { Q_ASSERT(d->probee);