From f1c4093f3710c8c061a68afbd52d0eafe0d6fc83 Mon Sep 17 00:00:00 2001 From: Lev Zelenskiy Date: Wed, 18 Apr 2012 13:11:53 +1000 Subject: [PATCH] Disconnect probe control in case source was destroyed. Change-Id: Ibc4583af8acf7d28ee2504f246840a26e3a527be Reviewed-by: Dmytro Poplavskiy Reviewed-by: Mithra Pattison Reviewed-by: Michael Goddard --- src/multimedia/audio/qaudioprobe.cpp | 8 ++++++++ src/multimedia/video/qvideoprobe.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) 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);