diff options
author | vng <viktor.govako@gmail.com> | 2010-12-05 22:32:54 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:06:51 +0300 |
commit | d4453055ded8f6406ebf46f747c669f2cd1624e3 (patch) | |
tree | a0b9e97c63f81074a15661929dbfccb7a26564d3 /qt/main.cpp | |
parent | da47a6f4bbc00fc845a0898caa5d7108bd8584ab (diff) |
Fix qt leak and file leak.
Diffstat (limited to 'qt/main.cpp')
-rw-r--r-- | qt/main.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/qt/main.cpp b/qt/main.cpp index ec7d40c458..ce74c6e29f 100644 --- a/qt/main.cpp +++ b/qt/main.cpp @@ -28,27 +28,39 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, bearerLoader, namespace { - class InitializeFinalize + class FinalizeBase { public: + ~FinalizeBase() + { + // optional - clean allocated data in protobuf library + // useful when using memory and resource leak utilites + //google::protobuf::ShutdownProtobufLibrary(); + } + }; + +#if defined(OMIM_OS_WINDOWS) //&& defined(PROFILER_COMMON) + class InitializeFinalize : public FinalizeBase + { + FILE * m_errFile; + public: InitializeFinalize() { // App runs without error console under win32. -#if defined(OMIM_OS_WINDOWS) //&& defined(PROFILER_COMMON) - freopen("mapswithme.log", "w", stderr); + m_errFile = ::freopen("mapswithme.log", "w", stderr); my::g_LogLevel = my::LDEBUG; //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_DELAY_FREE_MEM_DF); //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); -#endif } ~InitializeFinalize() { - // optional - clean allocated data in protobuf library - // useful when using memory and resource leak utilites - //google::protobuf::ShutdownProtobufLibrary(); + ::fclose(m_errFile); } }; +#else + typedef FinalizeBase InitializeFinalize; +#endif } int main(int argc, char *argv[]) |