Do not delete WindowTextAtom on WM_NCDESTROY, default WM_NCCREATE might

not have been called (overridden) messing up the WindowTextAtom ref count

svn path=/trunk/; revision=4888
This commit is contained in:
Gé van Geldorp 2003-06-14 09:59:17 +00:00
parent 814ac65da6
commit 9c7d6c225d

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.50 2003/05/29 13:17:41 gvg Exp $ /* $Id: defwnd.c,v 1.51 2003/06/14 09:59:17 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -1397,9 +1397,12 @@ DefWindowProcA(HWND hWnd,
{ {
CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam; CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
if (HIWORD(Cs->lpszName)) if (HIWORD(Cs->lpszName))
{
if (0 == WindowTextAtom)
{ {
WindowTextAtom = WindowTextAtom =
(LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA"); (LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA");
}
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
strlen(Cs->lpszName) * sizeof(CHAR)); strlen(Cs->lpszName) * sizeof(CHAR));
strcpy(WindowText, Cs->lpszName); strcpy(WindowText, Cs->lpszName);
@ -1474,10 +1477,6 @@ DefWindowProcA(HWND hWnd,
{ {
RtlFreeHeap(GetProcessHeap(), 0, WindowText); RtlFreeHeap(GetProcessHeap(), 0, WindowText);
} }
if (WindowTextAtom != 0)
{
GlobalDeleteAtom((ATOM)(ULONG)WindowTextAtom);
}
return(0); return(0);
} }
@ -1505,9 +1504,12 @@ DefWindowProcW(HWND hWnd,
{ {
CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam; CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
if (HIWORD(Cs->lpszName)) if (HIWORD(Cs->lpszName))
{
if (0 == WindowTextAtom)
{ {
WindowTextAtom = WindowTextAtom =
(LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW"); (LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW");
}
WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0,
wcslen(Cs->lpszName) * sizeof(WCHAR)); wcslen(Cs->lpszName) * sizeof(WCHAR));
wcscpy(WindowText, Cs->lpszName); wcscpy(WindowText, Cs->lpszName);
@ -1582,11 +1584,6 @@ DefWindowProcW(HWND hWnd,
{ {
RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText); RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText);
} }
if (WindowTextAtom != 0)
{
GlobalDeleteAtom((ATOM)(DWORD)WindowTextAtom);
}
return(0); return(0);
} }