mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:52:56 +00:00
[EXPLORER_NEW]
- Plug a memory leak in IDropTargetImpl - Do not allocate 64x the required space in TaskSwitchWnd_AllocTaskItem - Properly free and unregister the tray window - Fix a few more style issues svn path=/trunk/; revision=58123
This commit is contained in:
parent
b9a482f6fd
commit
6effe35b24
8 changed files with 78 additions and 70 deletions
|
@ -62,6 +62,9 @@ static VOID
|
|||
IDropTargetImpl_Free(IDropTargetImpl *This)
|
||||
{
|
||||
IDropTargetHelper_Release(This->DropTargetHelper);
|
||||
HeapFree(hProcessHeap,
|
||||
0,
|
||||
This);
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE
|
||||
|
@ -127,7 +130,7 @@ CreateDropTarget(IN HWND hwndTarget,
|
|||
IDropTargetImpl *This;
|
||||
HRESULT hr;
|
||||
|
||||
This = (IDropTargetImpl *)HeapAlloc(hProcessHeap,
|
||||
This = HeapAlloc(hProcessHeap,
|
||||
0,
|
||||
FIELD_OFFSET(IDropTargetImpl,
|
||||
Formats[nSupportedFormats]));
|
||||
|
@ -159,7 +162,7 @@ CreateDropTarget(IN HWND hwndTarget,
|
|||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
&IID_IDropTargetHelper,
|
||||
(PVOID)&This->DropTargetHelper);
|
||||
(PVOID *)&This->DropTargetHelper);
|
||||
|
||||
if (!SUCCEEDED(hr))
|
||||
{
|
||||
|
|
|
@ -311,7 +311,7 @@ GetVersionInfoString(IN TCHAR *szFileName,
|
|||
(LPVOID *)&lpTranslate,
|
||||
&cbTranslate);
|
||||
|
||||
for (i = 0;i < (cbTranslate / sizeof(LANGCODEPAGE));i++)
|
||||
for (i = 0; i < cbTranslate / sizeof(LANGCODEPAGE); i++)
|
||||
{
|
||||
/* If the bottom eight bits of the language id's
|
||||
match, use this version information (since this
|
||||
|
@ -410,7 +410,11 @@ _tWinMain(IN HINSTANCE hInstance,
|
|||
}
|
||||
|
||||
if (Tray != NULL)
|
||||
{
|
||||
TrayMessageLoop(Tray);
|
||||
ITrayWindow_Release(Tray);
|
||||
UnregisterTrayWindowClass();
|
||||
}
|
||||
|
||||
if (hShellDesktop != NULL)
|
||||
DesktopDestroyShellWindow(hShellDesktop);
|
||||
|
|
|
@ -59,7 +59,7 @@ CreateContextMenuFromShellFolderPidl(IN HWND hWndOwner,
|
|||
hRet = IShellFolder_GetUIObjectOf(psf,
|
||||
hWndOwner,
|
||||
1,
|
||||
(LPCITEMIDLIST*)&pidl, /* FIXME: shouldn't need a typecast! */
|
||||
(LPCITEMIDLIST *)&pidl,
|
||||
&IID_IContextMenu,
|
||||
NULL,
|
||||
(PVOID *)&pcm);
|
||||
|
@ -82,9 +82,10 @@ CreateContextMenuFromShellFolderPidl(IN HWND hWndOwner,
|
|||
return hPopup;
|
||||
}
|
||||
|
||||
IContextMenu_Release(pcm);
|
||||
DestroyMenu(hPopup);
|
||||
}
|
||||
|
||||
IContextMenu_Release(pcm);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -96,7 +97,7 @@ OnStartContextMenuCommand(IN HWND hWndOwner,
|
|||
IN PVOID pcmContext OPTIONAL,
|
||||
IN PVOID Context OPTIONAL)
|
||||
{
|
||||
PSTARTMNU_CTMENU_CTX psmcmc = (PSTARTMNU_CTMENU_CTX)pcmContext;
|
||||
PSTARTMNU_CTMENU_CTX psmcmc = pcmContext;
|
||||
|
||||
if (uiCmdId != 0)
|
||||
{
|
||||
|
@ -231,7 +232,7 @@ CreateStartContextMenu(IN HWND hWndOwner,
|
|||
hRet = IShellFolder_BindToObject(psfDesktop,
|
||||
pidlStart,
|
||||
NULL,
|
||||
(REFIID)&IID_IShellFolder, /* FIXME: Shouldn't require a typecast */
|
||||
&IID_IShellFolder,
|
||||
(PVOID*)&psfStart);
|
||||
if (SUCCEEDED(hRet))
|
||||
{
|
||||
|
@ -255,7 +256,7 @@ CreateStartContextMenu(IN HWND hWndOwner,
|
|||
AddStartContextMenuItems(hWndOwner,
|
||||
hPopup);
|
||||
|
||||
*((PSTARTMNU_CTMENU_CTX*)ppcmContext) = psmcmc;
|
||||
*ppcmContext = psmcmc;
|
||||
return hPopup;
|
||||
}
|
||||
else
|
||||
|
@ -815,12 +816,11 @@ UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup,
|
|||
|
||||
hRet = IMenuPopup_QueryInterface(pMenuPopup,
|
||||
&IID_IBanneredBar,
|
||||
(PVOID)&pbb);
|
||||
(PVOID *)&pbb);
|
||||
if (SUCCEEDED(hRet))
|
||||
{
|
||||
hRet = IBanneredBar_SetBitmap(pbb, hbmBanner);
|
||||
|
||||
|
||||
/* Update the icon size */
|
||||
hRet = IBanneredBar_SetIconSize(pbb,
|
||||
bSmallIcons ? BMICON_SMALL : BMICON_LARGE);
|
||||
|
|
|
@ -852,7 +852,19 @@ TaskSwitchWnd_AllocTaskItem(IN OUT PTASK_SWITCH_WND This)
|
|||
|
||||
ASSERT(This->AllocatedTaskItems >= This->TaskItemCount);
|
||||
|
||||
if (This->TaskItemCount != 0)
|
||||
if (This->TaskItemCount == 0)
|
||||
{
|
||||
This->TaskItems = HeapAlloc(hProcessHeap,
|
||||
0,
|
||||
TASK_ITEM_ARRAY_ALLOC * sizeof(*This->TaskItems));
|
||||
if (This->TaskItems != NULL)
|
||||
{
|
||||
This->AllocatedTaskItems = TASK_ITEM_ARRAY_ALLOC;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
else if (This->TaskItemCount >= This->AllocatedTaskItems)
|
||||
{
|
||||
PTASK_ITEM NewArray;
|
||||
SIZE_T NewArrayLength, ActiveTaskItemIndex;
|
||||
|
@ -877,18 +889,6 @@ TaskSwitchWnd_AllocTaskItem(IN OUT PTASK_SWITCH_WND This)
|
|||
else
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
This->TaskItems = HeapAlloc(hProcessHeap,
|
||||
0,
|
||||
TASK_ITEM_ARRAY_ALLOC * sizeof(*This->TaskItems));
|
||||
if (This->TaskItems != NULL)
|
||||
{
|
||||
This->AllocatedTaskItems = TASK_ITEM_ARRAY_ALLOC;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return This->TaskItems + This->TaskItemCount++;
|
||||
}
|
||||
|
@ -2073,7 +2073,7 @@ ForwardContextMenuMsg:
|
|||
case WM_NCCREATE:
|
||||
{
|
||||
LPCREATESTRUCT CreateStruct = (LPCREATESTRUCT)lParam;
|
||||
This = (PTASK_SWITCH_WND)HeapAlloc(hProcessHeap,
|
||||
This = HeapAlloc(hProcessHeap,
|
||||
0,
|
||||
sizeof(*This));
|
||||
if (This == NULL)
|
||||
|
|
|
@ -239,7 +239,6 @@ SysPagerWnd_RemoveButton(IN OUT PSYS_PAGER_WND_DATA This,
|
|||
PNOTIFY_ITEM updateItem;
|
||||
deleteItem = *NotifyPointer;
|
||||
|
||||
|
||||
SendMessage(This->hWndToolbar,
|
||||
TB_DELETEBUTTON,
|
||||
deleteItem->Index,
|
||||
|
@ -611,16 +610,16 @@ static HWND
|
|||
CreateSysPagerWnd(IN HWND hWndParent,
|
||||
IN BOOL bVisible)
|
||||
{
|
||||
PSYS_PAGER_WND_DATA TcData;
|
||||
PSYS_PAGER_WND_DATA SpData;
|
||||
DWORD dwStyle;
|
||||
HWND hWnd = NULL;
|
||||
|
||||
TcData = HeapAlloc(hProcessHeap,
|
||||
SpData = HeapAlloc(hProcessHeap,
|
||||
0,
|
||||
sizeof(*TcData));
|
||||
if (TcData != NULL)
|
||||
sizeof(*SpData));
|
||||
if (SpData != NULL)
|
||||
{
|
||||
ZeroMemory(TcData, sizeof(*TcData));
|
||||
ZeroMemory(SpData, sizeof(*SpData));
|
||||
|
||||
/* Create the window. The tray window is going to move it to the correct
|
||||
position and resize it as needed. */
|
||||
|
@ -639,18 +638,20 @@ CreateSysPagerWnd(IN HWND hWndParent,
|
|||
hWndParent,
|
||||
NULL,
|
||||
hExplorerInstance,
|
||||
TcData);
|
||||
SpData);
|
||||
|
||||
if (hWnd == NULL)
|
||||
if (hWnd != NULL)
|
||||
{
|
||||
SetWindowTheme(hWnd, L"TrayNotify", NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapFree(hProcessHeap,
|
||||
0,
|
||||
TcData);
|
||||
SpData);
|
||||
}
|
||||
}
|
||||
|
||||
SetWindowTheme(hWnd, L"TrayNotify", NULL);
|
||||
|
||||
return hWnd;
|
||||
|
||||
}
|
||||
|
@ -1381,16 +1382,19 @@ CreateTrayClockWnd(IN HWND hWndParent,
|
|||
hWndParent,
|
||||
NULL,
|
||||
hExplorerInstance,
|
||||
(LPVOID)TcData);
|
||||
TcData);
|
||||
|
||||
if (hWnd == NULL)
|
||||
if (hWnd != NULL)
|
||||
{
|
||||
SetWindowTheme(hWnd, L"TrayNotify", NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapFree(hProcessHeap,
|
||||
0,
|
||||
TcData);
|
||||
}
|
||||
}
|
||||
SetWindowTheme(hWnd, L"TrayNotify", NULL);
|
||||
|
||||
return hWnd;
|
||||
|
||||
|
@ -1860,7 +1864,7 @@ CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow,
|
|||
hWndTrayWindow,
|
||||
NULL,
|
||||
hExplorerInstance,
|
||||
(LPVOID)TnData);
|
||||
TnData);
|
||||
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
|
|
|
@ -369,7 +369,7 @@ DisplayTrayProperties(ITrayWindow *Tray)
|
|||
PROPSHEETPAGE psp[5];
|
||||
TCHAR szCaption[256];
|
||||
|
||||
pPropInfo = (PPROPSHEET_INFO)HeapAlloc(hProcessHeap,
|
||||
pPropInfo = HeapAlloc(hProcessHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(PROPSHEET_INFO));
|
||||
if (!pPropInfo)
|
||||
|
|
|
@ -2769,14 +2769,12 @@ TrayMessageLoop(IN OUT ITrayWindow *Tray)
|
|||
|
||||
while (1)
|
||||
{
|
||||
Ret = (GetMessage(&Msg,
|
||||
Ret = GetMessage(&Msg,
|
||||
NULL,
|
||||
0,
|
||||
0) != 0);
|
||||
0);
|
||||
|
||||
if (Ret != -1)
|
||||
{
|
||||
if (!Ret)
|
||||
if (!Ret || Ret == -1)
|
||||
break;
|
||||
|
||||
if (This->StartMenuBand == NULL ||
|
||||
|
@ -2788,7 +2786,6 @@ TrayMessageLoop(IN OUT ITrayWindow *Tray)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* IShellDesktopTray
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue