Merge branch 'develop'
This commit is contained in:
commit
3356898833
@ -3,8 +3,8 @@
|
|||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
*
|
||||||
* @file: nana/detail/platform_spec.hpp
|
* @file: nana/detail/platform_spec.hpp
|
||||||
@ -128,6 +128,8 @@ namespace detail
|
|||||||
public:
|
public:
|
||||||
co_initializer();
|
co_initializer();
|
||||||
~co_initializer();
|
~co_initializer();
|
||||||
|
|
||||||
|
void task_mem_free(void* p);
|
||||||
private:
|
private:
|
||||||
HMODULE ole32_;
|
HMODULE ole32_;
|
||||||
};
|
};
|
||||||
|
@ -100,6 +100,18 @@ namespace detail
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void platform_spec::co_initializer::task_mem_free(void* p)
|
||||||
|
{
|
||||||
|
if (ole32_)
|
||||||
|
{
|
||||||
|
using CoTaskMemFree_t = void (__stdcall *)(LPVOID pv);
|
||||||
|
|
||||||
|
CoTaskMemFree_t free_fn = reinterpret_cast<CoTaskMemFree_t>(::GetProcAddress(ole32_, "CoTaskMemFree"));
|
||||||
|
if (free_fn)
|
||||||
|
free_fn(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct platform_spec::implementation
|
struct platform_spec::implementation
|
||||||
{
|
{
|
||||||
std::map<native_window_type, window_icons> iconbase;
|
std::map<native_window_type, window_icons> iconbase;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#if defined(NANA_WINDOWS)
|
#if defined(NANA_WINDOWS)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
|
# include "../detail/mswin/platform_spec.hpp"
|
||||||
# ifndef NANA_MINGW //<Shobjidl.h> isn't supported well on MinGW
|
# ifndef NANA_MINGW //<Shobjidl.h> isn't supported well on MinGW
|
||||||
# include <Shobjidl.h>
|
# include <Shobjidl.h>
|
||||||
# else
|
# else
|
||||||
@ -1247,7 +1248,7 @@ namespace nana
|
|||||||
#ifdef NANA_WINDOWS
|
#ifdef NANA_WINDOWS
|
||||||
std::optional<folderbox::path_type> target;
|
std::optional<folderbox::path_type> target;
|
||||||
|
|
||||||
::CoInitialize(nullptr);
|
nana::detail::platform_spec::co_initializer co_init;
|
||||||
#ifndef NANA_MINGW
|
#ifndef NANA_MINGW
|
||||||
IFileDialog *fd(nullptr);
|
IFileDialog *fd(nullptr);
|
||||||
HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&fd));
|
HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&fd));
|
||||||
@ -1294,11 +1295,9 @@ namespace nana
|
|||||||
if (FALSE != SHGetPathFromIDList(pidl, folder_path))
|
if (FALSE != SHGetPathFromIDList(pidl, folder_path))
|
||||||
target = folder_path;
|
target = folder_path;
|
||||||
|
|
||||||
CoTaskMemFree(pidl);
|
co_init.task_mem_free(pidl);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
::CoUninitialize();
|
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
|
|
||||||
#elif defined(NANA_POSIX)
|
#elif defined(NANA_POSIX)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user