Commit 4e47ccb4 authored by Alexandre Julliard's avatar Alexandre Julliard

There is no need for a private heap in comctl32, memory allocations

should go to the standard process heap (reported by Ge van Geldorp).
parent c91d9f0c
......@@ -57,10 +57,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
extern HANDLE COMCTL32_hHeap; /* handle to the private heap */
struct _DSA
{
INT nItemCount;
......@@ -370,15 +366,7 @@ DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags,
LPVOID WINAPI Alloc (DWORD dwSize)
{
LPVOID lpPtr;
TRACE("(0x%lx)\n", dwSize);
lpPtr = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize);
TRACE("-- ret=%p\n", lpPtr);
return lpPtr;
return LocalAlloc( LMEM_ZEROINIT, dwSize );
}
......@@ -403,18 +391,10 @@ LPVOID WINAPI Alloc (DWORD dwSize)
LPVOID WINAPI ReAlloc (LPVOID lpSrc, DWORD dwSize)
{
LPVOID lpDest;
TRACE("(%p 0x%08lx)\n", lpSrc, dwSize);
if (lpSrc)
lpDest = HeapReAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize);
return LocalReAlloc( lpSrc, dwSize, LMEM_ZEROINIT );
else
lpDest = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize);
TRACE("-- ret=%p\n", lpDest);
return lpDest;
return LocalAlloc( LMEM_ZEROINIT, dwSize);
}
......@@ -433,9 +413,7 @@ LPVOID WINAPI ReAlloc (LPVOID lpSrc, DWORD dwSize)
BOOL WINAPI Free (LPVOID lpMem)
{
TRACE("(%p)\n", lpMem);
return HeapFree (COMCTL32_hHeap, 0, lpMem);
return !LocalFree( lpMem );
}
......@@ -455,9 +433,7 @@ BOOL WINAPI Free (LPVOID lpMem)
DWORD WINAPI GetSize (LPVOID lpMem)
{
TRACE("(%p)\n", lpMem);
return HeapSize (COMCTL32_hHeap, 0, lpMem);
return LocalSize( lpMem );
}
......@@ -1656,38 +1632,6 @@ DSA_DeleteAllItems (const HDSA hdsa)
*/
/**************************************************************************
* DPA_Create [COMCTL32.328] Creates a dynamic pointer array
*
* PARAMS
* nGrow [I] number of items by which the array grows when it is filled
*
* RETURNS
* Success: handle (pointer) to the pointer array.
* Failure: NULL
*/
HDPA WINAPI
DPA_Create (INT nGrow)
{
HDPA hdpa;
TRACE("(%d)\n", nGrow);
hdpa = Alloc (sizeof(*hdpa));
if (hdpa) {
hdpa->nGrow = max(8, nGrow);
hdpa->hHeap = COMCTL32_hHeap;
hdpa->nMaxCount = hdpa->nGrow * 2;
hdpa->ptrs = Alloc (hdpa->nMaxCount * sizeof(LPVOID));
}
TRACE("-- %p\n", hdpa);
return hdpa;
}
/**************************************************************************
* DPA_Destroy [COMCTL32.329] Destroys a dynamic pointer array
*
* PARAMS
......@@ -2252,10 +2196,9 @@ DPA_CreateEx (INT nGrow, HANDLE hHeap)
if (hdpa) {
hdpa->nGrow = min(8, nGrow);
hdpa->hHeap = hHeap ? hHeap : COMCTL32_hHeap;
hdpa->hHeap = hHeap ? hHeap : GetProcessHeap();
hdpa->nMaxCount = hdpa->nGrow * 2;
hdpa->ptrs =
(LPVOID*)HeapAlloc (hHeap, HEAP_ZERO_MEMORY,
hdpa->ptrs = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpa->nMaxCount * sizeof(LPVOID));
}
......@@ -2266,6 +2209,24 @@ DPA_CreateEx (INT nGrow, HANDLE hHeap)
/**************************************************************************
* DPA_Create [COMCTL32.328] Creates a dynamic pointer array
*
* PARAMS
* nGrow [I] number of items by which the array grows when it is filled
*
* RETURNS
* Success: handle (pointer) to the pointer array.
* Failure: NULL
*/
HDPA WINAPI
DPA_Create (INT nGrow)
{
return DPA_CreateEx( nGrow, 0 );
}
/**************************************************************************
* Notification functions
*/
......
......@@ -115,7 +115,6 @@ extern void UPDOWN_Register(void);
extern void UPDOWN_Unregister(void);
HANDLE COMCTL32_hHeap = NULL;
LPSTR COMCTL32_aSubclass = NULL;
HMODULE COMCTL32_hModule = 0;
LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
......@@ -154,10 +153,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
COMCTL32_hModule = (HMODULE)hinstDLL;
/* create private heap */
COMCTL32_hHeap = HeapCreate (0, 0x10000, 0);
TRACE("Heap created: %p\n", COMCTL32_hHeap);
/* add global subclassing atom (used by 'tooltip' and 'updown') */
COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo");
TRACE("Subclassing atom added: %p\n", COMCTL32_aSubclass);
......@@ -218,11 +213,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass));
TRACE("Subclassing atom deleted: %p\n", COMCTL32_aSubclass);
COMCTL32_aSubclass = NULL;
/* destroy private heap */
HeapDestroy (COMCTL32_hHeap);
TRACE("Heap destroyed: %p\n", COMCTL32_hHeap);
COMCTL32_hHeap = NULL;
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment