From 8c3efa5926103d92bc612bb7070dacb5e026d86f Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Thu, 9 Feb 2017 03:55:40 -0500 Subject: [PATCH] Increment reference count when creating VideoSource object (#53) --- include/cscore_oo.inl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/cscore_oo.inl b/include/cscore_oo.inl index f2fd374830..890d4fa4cd 100644 --- a/include/cscore_oo.inl +++ b/include/cscore_oo.inl @@ -427,7 +427,8 @@ inline void VideoSink::SetSource(VideoSource source) { inline VideoSource VideoSink::GetSource() const { m_status = 0; - return VideoSource{GetSinkSource(m_handle, &m_status)}; + auto handle = GetSinkSource(m_handle, &m_status); + return VideoSource{handle == 0 ? 0 : CopySource(handle, &m_status)}; } inline VideoProperty VideoSink::GetSourceProperty(llvm::StringRef name) {