osxvideosink: fix segfault accessing osxwindow when not set yet
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Mon, 15 Apr 2013 14:32:46 +0000 (14:32 +0000)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 16 Apr 2013 12:54:06 +0000 (14:54 +0200)
sys/osxvideo/osxvideosink.m

index 9de76ff..cf939b1 100644 (file)
@@ -231,6 +231,7 @@ gst_osx_video_sink_osxwindow_create (GstOSXVideoSink * osxvideosink, gint width,
   osxwindow->width = width;
   osxwindow->height = height;
   osxwindow->closed = FALSE;
+  osxwindow->internal = FALSE;
 
   /* Allocate our GstGLView for the window, and then tell the application
    * about it (hopefully it's listening...) */
@@ -683,11 +684,11 @@ gst_osx_video_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle
       gst_osx_video_sink_call_from_main_thread(osxvideosink,
         osxvideosink->osxwindow->gstview,
         @selector(addToSuperview:), osxvideosink->superview, YES);
+    if (window_id) {
+      osxvideosink->osxwindow->internal = FALSE;
+    }
   }
 
-  if (window_id) {
-    osxvideosink->osxwindow->internal = FALSE;
-  }
 }
 
 static void