Commit fff50be3 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

shell32: Keep at least one reference to the autocompletion object at…

shell32: Keep at least one reference to the autocompletion object at initialization until the edit window is destroyed. Spotted with Valgrind.
parent 4145fe0e
......@@ -207,11 +207,9 @@ static ULONG WINAPI IAutoComplete2_fnRelease(
TRACE("(%p)->(%u)\n", This, refCount + 1);
if (!refCount) {
TRACE(" destroying IAutoComplete(%p)\n",This);
TRACE("destroying IAutoComplete(%p)\n", This);
HeapFree(GetProcessHeap(), 0, This->quickComplete);
HeapFree(GetProcessHeap(), 0, This->txtbackup);
if (This->hwndListBox)
DestroyWindow(This->hwndListBox);
if (This->enumstr)
IEnumString_Release(This->enumstr);
HeapFree(GetProcessHeap(), 0, This);
......@@ -275,6 +273,8 @@ static HRESULT WINAPI IAutoComplete2_fnInit(
This->initialized = TRUE;
This->hwndEdit = hwndEdit;
This->wpOrigEditProc = (WNDPROC) SetWindowLongPtrW( hwndEdit, GWLP_WNDPROC, (LONG_PTR) ACEditSubclassProc);
/* Keep at least one reference to the object until the edit window is destroyed. */
IAutoComplete2_AddRef((IAutoComplete2 *)This);
SetPropW( hwndEdit, autocomplete_propertyW, This );
if (This->options & ACO_AUTOSUGGEST)
......@@ -631,7 +631,12 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
{
WNDPROC proc = This->wpOrigEditProc;
RemovePropW(hwnd, autocomplete_propertyW);
SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)proc);
This->hwndEdit = NULL;
if (This->hwndListBox)
DestroyWindow(This->hwndListBox);
IAutoComplete2_Release((IAutoComplete2 *)This);
return CallWindowProcW(proc, hwnd, uMsg, wParam, lParam);
}
default:
......
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