diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-11-29 15:52:25 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-11-30 14:56:31 +0100 |
commit | 466a4f29c20b6d797af9d67029a7329b2124b276 (patch) | |
tree | dc3c006e86dca176309c9b68fcb8c7508b80394c | |
parent | 1aed4451f6616354bb12fbfc772fd900e35a338b (diff) |
Fix a memory leak in the camerabinsession
Properly unref the video and camera source objects when
changing the input device.
Fixes: QTBUG-93762
Change-Id: Ibaf08978b6915faa668ef0ab54b3bc0903daafad
Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index 26080f979..dd81240f0 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -479,6 +479,15 @@ GstElement *CameraBinSession::buildCameraSource() m_inputDeviceHasChanged = false; m_usingWrapperCameraBinSrc = false; + if (m_videoSrc) { + gst_object_unref(GST_OBJECT(m_videoSrc)); + m_videoSrc = 0; + } + if (m_cameraSrc) { + gst_object_unref(GST_OBJECT(m_cameraSrc)); + m_cameraSrc = 0; + } + GstElement *camSrc = 0; g_object_get(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, &camSrc, NULL); |