diff --git a/lib/widget/widget.c b/lib/widget/widget.c index 25ea87a4d..f14ca3db2 100644 --- a/lib/widget/widget.c +++ b/lib/widget/widget.c @@ -126,6 +126,13 @@ void widgReleaseWidgetList(WIDGET *psWidgets) for(psCurr = psWidgets; psCurr; psCurr = psNext) { psNext = psCurr->psNext; + + // the mouse can't be over it anymore + if (psMouseOverWidget && psMouseOverWidget->id == psCurr->id) + { + psMouseOverWidget = NULL; + } + switch(psCurr->type) { case WIDG_FORM: @@ -667,6 +674,11 @@ void widgDelete(W_SCREEN *psScreen, UDWORD id) { screenClearFocus(psScreen); } + // the mouse can't be over it anymore + if (psMouseOverWidget && psMouseOverWidget->id == id) + { + psMouseOverWidget = NULL; + } /* Set up the initial context */ sContext.psScreen = psScreen;