To work around harmless memory leaks reported by Visual C++ static runtime libs, assume that C++ typeid operator works well with VC++ 9.0 and later (fixes #12023)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66734 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,6 +27,17 @@
|
|||||||
|
|
||||||
#ifndef wxNO_RTTI
|
#ifndef wxNO_RTTI
|
||||||
|
|
||||||
|
//
|
||||||
|
// Let's trust that Visual C++ versions 9.0 and later implement C++
|
||||||
|
// RTTI well enough, so we can use it and work around harmless memory
|
||||||
|
// leaks reported by the static run-time libraries.
|
||||||
|
//
|
||||||
|
#if wxCHECK_VISUALC_VERSION(9)
|
||||||
|
#define wxTRUST_CPP_RTTI 1
|
||||||
|
#else
|
||||||
|
#define wxTRUST_CPP_RTTI 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -36,6 +47,12 @@
|
|||||||
#define WX_DEFINE_TYPEINFO(CLS)
|
#define WX_DEFINE_TYPEINFO(CLS)
|
||||||
#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS)
|
#define WX_DECLARE_ABSTRACT_TYPEINFO(CLS)
|
||||||
|
|
||||||
|
#if wxTRUST_CPP_RTTI
|
||||||
|
|
||||||
|
#define wxTypeId typeid
|
||||||
|
|
||||||
|
#else /* !wxTRUST_CPP_RTTI */
|
||||||
|
|
||||||
//
|
//
|
||||||
// For improved type-safety, let's make the check using class name
|
// For improved type-safety, let's make the check using class name
|
||||||
// comparison. Most modern compilers already do this, but we cannot
|
// comparison. Most modern compilers already do this, but we cannot
|
||||||
@@ -67,8 +84,12 @@ private:
|
|||||||
|
|
||||||
#define wxTypeId(OBJ) wxTypeIdentifier(typeid(OBJ).name())
|
#define wxTypeId(OBJ) wxTypeIdentifier(typeid(OBJ).name())
|
||||||
|
|
||||||
|
#endif /* wxTRUST_CPP_RTTI/!wxTRUST_CPP_RTTI */
|
||||||
|
|
||||||
#else // if !wxNO_RTTI
|
#else // if !wxNO_RTTI
|
||||||
|
|
||||||
|
#define wxTRUST_CPP_RTTI 0
|
||||||
|
|
||||||
//
|
//
|
||||||
// When C++ RTTI is not available, we will have to make the type comparison
|
// When C++ RTTI is not available, we will have to make the type comparison
|
||||||
// using pointer to a dummy static member function. This will fail if
|
// using pointer to a dummy static member function. This will fail if
|
||||||
|
Reference in New Issue
Block a user