Fixed bug 3451 - Raspberry Pi Raspbian SDL_assert triggered sometimes at RPI_WarpMouseGlobal

Eric wing

Sometimes an SDL_assert triggers at RPI_WarpMouseGlobal
src/video/raspberry/SDL_rpimouse.c:232 'update'.

It doesn't always reproduce, but it seems to happen when you really bog down the system and the event loop can't update for awhile.


The first time I hit this, I wasn't even using the mouse. I don't call any warp mouse functions either.


I can usually reproduce with a simple program that runs an expensive blocking CPU series of functions which blocks the main loop until complete (can be up to 10 seconds).

Sometimes this assertion gets triggered after that. I'm not sure if
they are related or coincidental.


Disabling the SDL_asserts when compiling SDL will avoid this problem. I actually haven't seen any problems with the mouse when I do this.

On a Raspberry Pi 2 running Raspbian Jessie.
This commit is contained in:
Sam Lantinga 2016-10-13 04:53:01 -07:00
parent c490b54e08
commit f94bd05736

View File

@ -235,11 +235,20 @@ RPI_WarpMouseGlobal(int x, int y)
VC_RECT_T src_rect;
SDL_Mouse *mouse = SDL_GetMouse();
if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {
return 0;
}
curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata;
if (curdata->element != DISPMANX_NO_HANDLE) {
if (curdata->element == DISPMANX_NO_HANDLE) {
return 0;
}
update = vc_dispmanx_update_start(10);
SDL_assert( update );
if (!update) {
return 0;
}
src_rect.x = 0;
src_rect.y = 0;
src_rect.width = curdata->w << 16;
@ -268,8 +277,6 @@ RPI_WarpMouseGlobal(int x, int y)
if (ret != DISPMANX_SUCCESS) {
return SDL_SetError("vc_dispmanx_update_submit() failed");
}
}
}
return 0;
}