Fix generic classinfo objects so that they are allocated statically, to avoid leak-detector annoyances, but not initialized statically, because compilers are stupid and won't const-data-initialize an object with a vtable, even if they could.

This commit is contained in:
Benjamin Smedberg 2010-07-01 12:11:42 -04:00
parent 4d172dd53d
commit c6e4b41b1f

View File

@ -39,6 +39,8 @@
#include "nsIClassInfo.h"
#include "nsISupportsImpl.h"
#include NEW_H
class GenericClassInfo : public nsIClassInfo
{
public:
@ -80,13 +82,15 @@ private:
_flags, \
_cid, \
}; \
static char k##_class##ClassInfoDataPlace[sizeof(GenericClassInfo)]; \
nsIClassInfo* NS_CLASSINFO_NAME(_class) = NULL;
#define NS_IMPL_QUERY_CLASSINFO(_class) \
if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \
if (!NS_CLASSINFO_NAME(_class)) \
NS_CLASSINFO_NAME(_class) = new GenericClassInfo(&k##_class##ClassInfoData); \
foundInterface = NS_CLASSINFO_NAME(_class); \
#define NS_IMPL_QUERY_CLASSINFO(_class) \
if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \
if (!NS_CLASSINFO_NAME(_class)) \
NS_CLASSINFO_NAME(_class) = new (k##_class##ClassInfoDataPlace) \
GenericClassInfo(&k##_class##ClassInfoData); \
foundInterface = NS_CLASSINFO_NAME(_class); \
} else
#define NS_CLASSINFO_HELPER_BEGIN(_class, _c) \