summaryrefslogtreecommitdiffstats
path: root/src/plugins/directshow/common/directshowsamplegrabber.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/directshow/common/directshowsamplegrabber.cpp')
-rw-r--r--src/plugins/directshow/common/directshowsamplegrabber.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/directshow/common/directshowsamplegrabber.cpp b/src/plugins/directshow/common/directshowsamplegrabber.cpp
index b33c3cfc..fb95370c 100644
--- a/src/plugins/directshow/common/directshowsamplegrabber.cpp
+++ b/src/plugins/directshow/common/directshowsamplegrabber.cpp
@@ -99,9 +99,11 @@ public:
STDMETHODIMP BufferCB(double time, BYTE *buffer, long bufferLen)
{
- if (m_grabber)
- Q_EMIT m_grabber->bufferAvailable(time, buffer, bufferLen);
-
+ if (m_grabber) {
+ // Deep copy, the data might be modified or freed after the callback returns
+ QByteArray data(reinterpret_cast<const char *>(buffer), bufferLen);
+ Q_EMIT m_grabber->bufferAvailable(time, data);
+ }
return S_OK;
}