Fix an invalid pointer reference in the widget code by making sure that the pointer to the widget currently under the mouse is cleared when the

widget is freed.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3064 4a71c877-e1ca-e34f-864e-861f7616d084
master
Gerard Krol 2007-12-15 14:33:56 +00:00
parent e0c450b415
commit 65c56b73e3
1 changed files with 12 additions and 0 deletions

View File

@ -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;