mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 21:10:42 +00:00
Don't leak iconv handle
This commit is contained in:
@@ -389,6 +389,8 @@ RenderDoc::~RenderDoc()
|
||||
Network::Shutdown();
|
||||
|
||||
Threading::Shutdown();
|
||||
|
||||
StringFormat::Shutdown();
|
||||
}
|
||||
|
||||
void RenderDoc::Shutdown()
|
||||
|
||||
@@ -331,6 +331,8 @@ namespace StringFormat
|
||||
void sntimef(char *str, size_t bufSize, const char *format);
|
||||
|
||||
string Wide2UTF8(const std::wstring &s);
|
||||
|
||||
void Shutdown();
|
||||
};
|
||||
|
||||
// utility functions, implemented in os_specific.cpp, not per-platform (assuming standard stdarg.h)
|
||||
|
||||
@@ -101,6 +101,10 @@ string Wide2UTF8(const std::wstring &s)
|
||||
RDCFATAL("Converting wide strings to UTF-8 is not supported on Android!");
|
||||
return "";
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
namespace OSUtility
|
||||
|
||||
@@ -117,6 +117,10 @@ string Wide2UTF8(const std::wstring &s)
|
||||
RDCFATAL("Converting wide strings to UTF-8 is not supported on Apple!");
|
||||
return "";
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
namespace OSUtility
|
||||
|
||||
@@ -294,6 +294,13 @@ iconv_t iconvWide2UTF8 = (iconv_t)-1;
|
||||
// before creating a temporary iconv_t, or hold two iconv_ts, or something.
|
||||
Threading::CriticalSection lockWide2UTF8;
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
SCOPED_LOCK(lockWide2UTF8);
|
||||
iconv_close(iconvWide2UTF8);
|
||||
iconvWide2UTF8 = (iconv_t)-1;
|
||||
}
|
||||
|
||||
string Wide2UTF8(const std::wstring &s)
|
||||
{
|
||||
// include room for null terminator, assuming unicode input (not ucs)
|
||||
|
||||
@@ -659,6 +659,10 @@ void sntimef(char *str, size_t bufSize, const char *format)
|
||||
}
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
string Wide2UTF8(const wstring &s)
|
||||
{
|
||||
int bytes_required = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, NULL, 0, NULL, NULL);
|
||||
|
||||
Reference in New Issue
Block a user