diff src/video/qnxgf/SDL_qnxgf.c @ 3461:87182c69e080

Deinitialization fixes, in case if QNXGF driver is not initialized properly.
author Mike Gorchak <lestat@i.com.ua>
date Fri, 20 Nov 2009 07:06:50 +0000
parents fe9c8a5cab51
children 4b594623401b
line wrap: on
line diff
--- a/src/video/qnxgf/SDL_qnxgf.c	Thu Nov 19 09:07:09 2009 +0000
+++ b/src/video/qnxgf/SDL_qnxgf.c	Fri Nov 20 07:06:50 2009 +0000
@@ -251,6 +251,9 @@
     }
     device->driverdata = gfdata;
 
+    /* By default GF is not initialized */
+    gfdata->gfinitialized = SDL_FALSE;
+
     /* Try to attach to graphics device driver */
     status =
         gf_dev_attach(&gfdata->gfdev, GF_DEVICE_INDEX(devindex),
@@ -543,9 +546,17 @@
 void
 qnxgf_videoquit(_THIS)
 {
+    SDL_VideoData *gfdata = (SDL_VideoData *) _this->driverdata;
     SDL_DisplayData *didata = NULL;
     uint32_t it;
 
+    /* Check if GF was initialized before */
+    if ((gfdata == NULL) || (gfdata->gfinitialized != SDL_TRUE))
+    {
+        /* If not, do not deinitialize */
+        return;
+    }
+
     /* Stop collecting mouse events */
     hiddi_disable_mouse();
     /* Delete GF input devices */