Fixed a major memory leak in the window management code.

This commit is contained in:
Francis Beaudet 1999-05-22 19:21:01 +00:00 committed by Alexandre Julliard
parent 6cf348d70a
commit 4812647155
1 changed files with 2 additions and 3 deletions

View File

@ -177,17 +177,17 @@ void WIN_ReleaseWndPtr(WND *wndPtr)
/*Decrement destruction monitoring value*/ /*Decrement destruction monitoring value*/
wndPtr->irefCount--; wndPtr->irefCount--;
/* Check if it's time to release the memory*/
/* Check if it's time to release the memory*/ /* Check if it's time to release the memory*/
if(wndPtr->irefCount == 0 && !wndPtr->dwMagic) if(wndPtr->irefCount == 0 && !wndPtr->dwMagic)
{ {
/* Release memory */ /* Release memory */
USER_HEAP_FREE( wndPtr->hwndSelf); USER_HEAP_FREE( wndPtr->hwndSelf);
wndPtr->hwndSelf = 0;
} }
else if(wndPtr->irefCount < 0) else if(wndPtr->irefCount < 0)
{ {
/* This else if is useful to monitor the WIN_ReleaseWndPtr function */ /* This else if is useful to monitor the WIN_ReleaseWndPtr function */
TRACE_(win)("forgot a Lock on %p somewhere\n",wndPtr); ERR_(win)("forgot a Lock on %p somewhere\n",wndPtr);
} }
/*unlock all WND structures for thread safeness*/ /*unlock all WND structures for thread safeness*/
WIN_UnlockWnds(); WIN_UnlockWnds();
@ -516,7 +516,6 @@ static WND* WIN_DestroyWindow( WND* wndPtr )
wndPtr->pDriver->pDestroyWindow( wndPtr ); wndPtr->pDriver->pDestroyWindow( wndPtr );
DCE_FreeWindowDCE( wndPtr ); /* Always do this to catch orphaned DCs */ DCE_FreeWindowDCE( wndPtr ); /* Always do this to catch orphaned DCs */
WINPROC_FreeProc( wndPtr->winproc, WIN_PROC_WINDOW ); WINPROC_FreeProc( wndPtr->winproc, WIN_PROC_WINDOW );
wndPtr->hwndSelf = 0;
wndPtr->class->cWindows--; wndPtr->class->cWindows--;
wndPtr->class = NULL; wndPtr->class = NULL;