Use wxCoTaskMemPtr

Use RAII class wxCoTaskMemPtr to manage pointers that must
be freed with ::CoTaskMemFree().
This commit is contained in:
PB
2020-06-09 20:17:25 +02:00
parent d445111e77
commit 9ff095a852
4 changed files with 19 additions and 36 deletions

View File

@@ -29,6 +29,7 @@
#include "wx/msw/taskbarbutton.h"
#include "wx/scopedptr.h"
#include "wx/msw/private/comptr.h"
#include "wx/msw/private/cotaskmemptr.h"
#include <shlwapi.h>
#include <initguid.h>
@@ -498,10 +499,9 @@ wxTaskBarJumpListItem* GetItemFromIShellItem(IShellItem *shellItem)
wxTaskBarJumpListItem *item =
new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_DESTINATION);
wchar_t *name;
wxCoTaskMemPtr<wchar_t> name;
shellItem->GetDisplayName(SIGDN_FILESYSPATH, &name);
item->SetFilePath(wxString(name));
CoTaskMemFree(name);
return item;
}