https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d6c44112073a23525501c…
commit d6c44112073a23525501cf4435a94a0c39a7996d
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Tue Mar 31 09:39:16 2020 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sat Jul 11 01:44:26 2020 +0200
[MSGINA] gui: Improve 'DlgData_Destroy()'
Addendum to 623dd26ccea5e79001aee769c230fb4f8e304fc8.
---
dll/win32/msgina/gui.c | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/dll/win32/msgina/gui.c b/dll/win32/msgina/gui.c
index 3cb30bb638f..106a4ebcb96 100644
--- a/dll/win32/msgina/gui.c
+++ b/dll/win32/msgina/gui.c
@@ -86,14 +86,29 @@ DlgData_LoadBitmaps(_Inout_ PDLG_DATA pDlgData)
}
}
-static void
-DlgData_Destroy(PDLG_DATA pDlgData)
+static VOID
+DlgData_Destroy(_Inout_ HWND hwndDlg)
{
+ PDLG_DATA pDlgData;
+
+ pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
if (!pDlgData)
+ {
return;
+ }
+
+ SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)NULL);
+
+ if (pDlgData->hBarBitmap)
+ {
+ DeleteObject(pDlgData->hBarBitmap);
+ }
+
+ if (pDlgData->hLogoBitmap)
+ {
+ DeleteObject(pDlgData->hLogoBitmap);
+ }
- DeleteObject(pDlgData->hLogoBitmap);
- DeleteObject(pDlgData->hBarBitmap);
HeapFree(GetProcessHeap(), 0, pDlgData);
}
@@ -264,7 +279,7 @@ StatusDialogProc(
{
KillTimer(hwndDlg, IDT_BAR);
}
- DlgData_Destroy(pDlgData);
+ DlgData_Destroy(hwndDlg);
return TRUE;
}
}
@@ -434,7 +449,7 @@ WelcomeDialogProc(
}
case WM_DESTROY:
{
- DlgData_Destroy(pDlgData);
+ DlgData_Destroy(hwndDlg);
return TRUE;
}
}
@@ -1230,7 +1245,7 @@ LogonDialogProc(
}
case WM_DESTROY:
- DlgData_Destroy(pDlgData);
+ DlgData_Destroy(hwndDlg);
return TRUE;
case WM_COMMAND:
@@ -1489,7 +1504,7 @@ UnlockDialogProc(
return TRUE;
}
case WM_DESTROY:
- DlgData_Destroy(pDlgData);
+ DlgData_Destroy(hwndDlg);
return TRUE;
case WM_COMMAND:
@@ -1577,7 +1592,7 @@ LockedDialogProc(
}
case WM_DESTROY:
{
- DlgData_Destroy(pDlgData);
+ DlgData_Destroy(hwndDlg);
return TRUE;
}
}