fix potential crashes in input config dialog when setting joystick buttons, by using uiQueueMain()
how could I not think of this? GTK is not thread safe.
This commit is contained in:
parent
5c5146945c
commit
65c27c5c28
|
@ -165,6 +165,21 @@ int OnAreaKeyEvent(uiAreaHandler* handler, uiArea* area, uiAreaKeyEvent* evt)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FinishJoyMapping(void* param)
|
||||||
|
{
|
||||||
|
InputDlgData* dlg = (InputDlgData*)param;
|
||||||
|
int id = dlg->pollid & 0xFF;
|
||||||
|
|
||||||
|
char keyname[16];
|
||||||
|
JoyMappingName(dlg->joymap[id], keyname);
|
||||||
|
uiButtonSetText(dlg->pollbtn, keyname);
|
||||||
|
uiControlEnable(uiControl(dlg->pollbtn));
|
||||||
|
|
||||||
|
dlg->pollid = -1;
|
||||||
|
|
||||||
|
uiControlSetFocus(uiControl(dlg->pollbtn));
|
||||||
|
}
|
||||||
|
|
||||||
Uint32 JoyPoll(Uint32 interval, void* param)
|
Uint32 JoyPoll(Uint32 interval, void* param)
|
||||||
{
|
{
|
||||||
InputDlgData* dlg = (InputDlgData*)param;
|
InputDlgData* dlg = (InputDlgData*)param;
|
||||||
|
@ -184,15 +199,7 @@ Uint32 JoyPoll(Uint32 interval, void* param)
|
||||||
if (SDL_JoystickGetButton(joy, i))
|
if (SDL_JoystickGetButton(joy, i))
|
||||||
{
|
{
|
||||||
dlg->joymap[id] = i;
|
dlg->joymap[id] = i;
|
||||||
|
uiQueueMain(FinishJoyMapping, dlg);
|
||||||
char keyname[16];
|
|
||||||
JoyMappingName(dlg->joymap[id], keyname);
|
|
||||||
uiButtonSetText(dlg->pollbtn, keyname);
|
|
||||||
uiControlEnable(uiControl(dlg->pollbtn));
|
|
||||||
|
|
||||||
dlg->pollid = -1;
|
|
||||||
|
|
||||||
uiControlSetFocus(uiControl(dlg->pollbtn));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,15 +213,7 @@ Uint32 JoyPoll(Uint32 interval, void* param)
|
||||||
else blackhat = 0x8;
|
else blackhat = 0x8;
|
||||||
|
|
||||||
dlg->joymap[id] = 0x100 | blackhat;
|
dlg->joymap[id] = 0x100 | blackhat;
|
||||||
|
uiQueueMain(FinishJoyMapping, dlg);
|
||||||
char keyname[16];
|
|
||||||
JoyMappingName(dlg->joymap[id], keyname);
|
|
||||||
uiButtonSetText(dlg->pollbtn, keyname);
|
|
||||||
uiControlEnable(uiControl(dlg->pollbtn));
|
|
||||||
|
|
||||||
dlg->pollid = -1;
|
|
||||||
|
|
||||||
uiControlSetFocus(uiControl(dlg->pollbtn));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue