Fixed crash when QMediaObject is deleted before QMediaRecorder.
Change-Id: I8a1674b6f3d2b2c9ab888facff21f94af41b81de Reviewed-on: http://codereview.qt.nokia.com/3544 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
5d71ee6abf
commit
ba62df130c
@@ -168,7 +168,12 @@ void QMediaRecorderPrivate::_q_error(int error, const QString &errorString)
|
||||
|
||||
void QMediaRecorderPrivate::_q_serviceDestroyed()
|
||||
{
|
||||
q_func()->setMediaObject(0);
|
||||
mediaObject = 0;
|
||||
control = 0;
|
||||
formatControl = 0;
|
||||
audioControl = 0;
|
||||
videoControl = 0;
|
||||
metaDataControl = 0;
|
||||
}
|
||||
|
||||
void QMediaRecorderPrivate::_q_notify()
|
||||
|
||||
@@ -165,6 +165,26 @@ void tst_QMediaRecorder::testNullControls()
|
||||
QCOMPARE(spy.count(), 0);
|
||||
}
|
||||
|
||||
void tst_QMediaRecorder::testDeleteMediaObject()
|
||||
{
|
||||
MockMediaRecorderControl *mock = new MockMediaRecorderControl(this);
|
||||
MockMediaRecorderService *service = new MockMediaRecorderService(this, mock);
|
||||
MockMediaObject *object = new MockMediaObject(this, service);
|
||||
QMediaRecorder *capture = new QMediaRecorder(object);
|
||||
|
||||
QVERIFY(capture->mediaObject() == object);
|
||||
QVERIFY(capture->isAvailable());
|
||||
|
||||
delete object;
|
||||
delete service;
|
||||
delete mock;
|
||||
|
||||
QVERIFY(capture->mediaObject() == 0);
|
||||
QVERIFY(!capture->isAvailable());
|
||||
|
||||
delete capture;
|
||||
}
|
||||
|
||||
void tst_QMediaRecorder::testError()
|
||||
{
|
||||
const QString errorString(QLatin1String("format error"));
|
||||
|
||||
@@ -70,6 +70,7 @@ public slots:
|
||||
private slots:
|
||||
void testNullService();
|
||||
void testNullControls();
|
||||
void testDeleteMediaObject();
|
||||
void testError();
|
||||
void testSink();
|
||||
void testRecord();
|
||||
|
||||
Reference in New Issue
Block a user