From: Matthew Waters Date: Sat, 17 Nov 2012 14:16:44 +0000 (+1100) Subject: [613/906] window_cocoa: fix segfault with gst-launch-1.0 -e ... and sending SIGINT... X-Git-Tag: 1.19.3~511^2~1989^2~1903 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc4619f8a9475227e4655a01bc395c6b429c121e;p=platform%2Fupstream%2Fgstreamer.git [613/906] window_cocoa: fix segfault with gst-launch-1.0 -e ... and sending SIGINT (Ctrl-C) GNUstep has a signal handler for SIGINT which runs in the main thread. However that thread has never been 'registered' with GNUstep so the autorelease magic of objective-c causes a segfault from accessing a null NSThread object somewhere deep in GNUstep. --- diff --git a/gst-libs/gst/gl/gstglwindow_cocoa.m b/gst-libs/gst/gl/gstglwindow_cocoa.m index c25c002..2c657da 100755 --- a/gst-libs/gst/gl/gstglwindow_cocoa.m +++ b/gst-libs/gst/gl/gstglwindow_cocoa.m @@ -588,6 +588,17 @@ gst_gl_window_cocoa_send_message (GstGLWindow * window, GstGLWindowCB callback, } - (void) applicationWillTerminate:(NSNotification *)aNotification { +#ifdef GNUSTEP + /* fixes segfault with gst-launch-1.0 -e ... and sending SIGINT (Ctrl-C) + * which causes GNUstep to run a signal handler in the main thread. + * However that thread has never been 'registered' with GNUstep so + * the autorelease magic of objective-c causes a segfault from accessing + * a null NSThread object somewhere deep in GNUstep. + * + * I put it here because this is the first time we can register the thread. + */ + GSRegisterCurrentThread(); +#endif } @end