Bug 898916 - Properly align statically allocated classinfo objects. r=bsmedberg

This commit is contained in:
Mike Hommey 2013-07-30 08:57:28 +09:00
parent 32495789b5
commit 378ab5094e

View File

@ -7,6 +7,7 @@
#include "nsIClassInfo.h"
#include "nsISupportsImpl.h"
#include "mozilla/Util.h"
#include <new>
@ -119,13 +120,13 @@ private:
_flags | nsIClassInfo::SINGLETON_CLASSINFO, \
_cid, \
}; \
static char k##_class##ClassInfoDataPlace[sizeof(GenericClassInfo)]; \
mozilla::AlignedStorage2<GenericClassInfo> k##_class##ClassInfoDataPlace; \
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 (k##_class##ClassInfoDataPlace) \
NS_CLASSINFO_NAME(_class) = new (k##_class##ClassInfoDataPlace.addr()) \
GenericClassInfo(&k##_class##ClassInfoData); \
foundInterface = NS_CLASSINFO_NAME(_class); \
} else