Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Deinitialization fixes, in case if QNXGF driver is not initialized pr…
Browse files Browse the repository at this point in the history
…operly.
  • Loading branch information
llmike committed Nov 20, 2009
1 parent 331122d commit cde9384
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/video/qnxgf/SDL_gf_input.c
Expand Up @@ -1071,6 +1071,7 @@ hiddi_connect_devices()

status = hidd_connect(&hidparams, &connection);
if (status != EOK) {
connection=NULL;
return -1;
}

Expand All @@ -1097,6 +1098,7 @@ hiddi_connect_devices()
/* Disconnect from HID server */
status = hidd_disconnect(connection);
if (status != EOK) {
connection=NULL;
return -1;
}

Expand All @@ -1105,6 +1107,7 @@ hiddi_connect_devices()

status = hidd_connect(&hidparams, &connection);
if (status != EOK) {
connection=NULL;
return -1;
}

Expand All @@ -1119,9 +1122,12 @@ hiddi_disconnect_devices()
hiddi_disable_mouse();

/* Disconnect from HID server */
status = hidd_disconnect(connection);
if (status != EOK) {
return -1;
if (connection!=NULL)
{
status = hidd_disconnect(connection);
if (status != EOK) {
return -1;
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/video/qnxgf/SDL_qnxgf.c
Expand Up @@ -251,6 +251,9 @@ qnxgf_create(int devindex)
}
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),
Expand Down Expand Up @@ -543,9 +546,17 @@ qnxgf_videoinit(_THIS)
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 */
Expand Down

0 comments on commit cde9384

Please sign in to comment.