From: Tom Briden Date: Thu, 27 Oct 2016 15:56:44 +0000 (+0100) Subject: Pre-allocate TouchState on the stack and pass it's address to GetState X-Git-Url: https://code.delx.au/refind/commitdiff_plain/874e66c90f7dc2da834032a46b3db3e5295aa16a Pre-allocate TouchState on the stack and pass it's address to GetState On some systems, GetState doesn't allocate TouchState when passed in as NULL causing a lockup later when getting X/Y positions --- diff --git a/refind/menu.c b/refind/menu.c index 762fd7a..4191e5d 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -396,7 +396,7 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty UINTN MenuExit; EFI_STATUS TouchStatus = EFI_NOT_READY; - EFI_ABSOLUTE_POINTER_STATE *TouchState = NULL; + EFI_ABSOLUTE_POINTER_STATE TouchState; if (Screen->TimeoutSeconds > 0) { HaveTimeout = TRUE; @@ -469,7 +469,7 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty // read key press or touch event (and wait for them if applicable) if(TouchEnabled) { - TouchStatus = refit_call2_wrapper(TouchProtocol->GetState, TouchProtocol, TouchState); + TouchStatus = refit_call2_wrapper(TouchProtocol->GetState, TouchProtocol, &TouchState); } Status = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &key); @@ -614,7 +614,7 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty break; } } else { //react to touch event - UINTN Item = FindMainMenuItem(Screen, &State, TouchState->CurrentX, TouchState->CurrentY); + UINTN Item = FindMainMenuItem(Screen, &State, TouchState.CurrentX, TouchState.CurrentY); switch (Item) { case TOUCH_NO_ITEM: //do nothing