Make it possible to use wxCharBuffer during program initialization.

wxCharBuffer might be used during static initialization, even if only
implicitly. E.g. it is used by wxString::Format() which can be used to
initialize a global string. But it uses the global s_untypedNullData variable
might not be initialized yet resulting in mysterious failures.

Fix this in the usual way by wrapping access to the variable via a function.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-02-28 11:09:26 +00:00
parent 321f760bc3
commit b96a56e60e
2 changed files with 12 additions and 12 deletions

View File

@@ -56,12 +56,8 @@ struct UntypedBufferData
bool m_owned;
};
// this has to be defined inside the DLL (and not e.g. as a static variable
// inside an inline function) as otherwise MSVC gives link errors when the
// functions are effectively inlined (i.e. in non-debug build)
//
// NB: this is defined in string.cpp and not the (non-existent) buffer.cpp
extern WXDLLIMPEXP_DATA_BASE(UntypedBufferData * const) untypedNullDataPtr;
WXDLLIMPEXP_BASE UntypedBufferData * GetUntypedNullData();
} // namespace wxPrivate
@@ -186,7 +182,7 @@ protected:
// placeholder for NULL string, to simplify this code
static Data *GetNullData()
{
return static_cast<Data *>(wxPrivate::untypedNullDataPtr);
return static_cast<Data *>(wxPrivate::GetUntypedNullData());
}
void IncRef()