From 182dad5c6694cd4bee1fa030d9b968687e21d522 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Sun, 9 Aug 2009 12:25:01 +0200 Subject: directdrawsink: Fix crash when exposing in GST_STATE_READY Fixes bug #541962. --- sys/directdraw/gstdirectdrawsink.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/directdraw') diff --git a/sys/directdraw/gstdirectdrawsink.c b/sys/directdraw/gstdirectdrawsink.c index 538227de..bb0332f8 100644 --- a/sys/directdraw/gstdirectdrawsink.c +++ b/sys/directdraw/gstdirectdrawsink.c @@ -961,10 +961,12 @@ gst_directdraw_sink_show_frame (GstBaseSink * bsink, GstBuffer * buf) /* Write each line respecting the destination surface pitch */ data = surf_desc.lpSurface; - src_pitch = GST_BUFFER_SIZE (buf) / ddrawsink->video_height; - for (line = 0; line < surf_desc.dwHeight; line++) { - memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch), src_pitch); - data += surf_desc.lPitch; + if (ddrawsink->video_height) { + src_pitch = GST_BUFFER_SIZE (buf) / ddrawsink->video_height; + for (line = 0; line < surf_desc.dwHeight; line++) { + memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch), src_pitch); + data += surf_desc.lPitch; + } } /* Unlock the surface */ -- cgit v1.2.1