Bug 747870 - Properly align XPCLazyCallContext::mData. r=bholley

This commit is contained in:
Mike Hommey 2012-04-25 09:09:08 +02:00
Родитель 0f59bb65bb
Коммит ae37a8da89
1 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -1310,12 +1310,13 @@ public:
XPCCallContext &GetXPCCallContext() XPCCallContext &GetXPCCallContext()
{ {
if (!mCcx) { if (!mCcx) {
XPCCallContext *data = mData.addr();
mCcxToDestroy = mCcx = mCcxToDestroy = mCcx =
new (mData) XPCCallContext(mCallerLanguage, mCx, new (data) XPCCallContext(mCallerLanguage, mCx,
mCallBeginRequest == CALL_BEGINREQUEST, mCallBeginRequest == CALL_BEGINREQUEST,
mObj, mObj,
mFlattenedJSObject, mWrapper, mFlattenedJSObject, mWrapper,
mTearOff); mTearOff);
if (!mCcx->IsValid()) { if (!mCcx->IsValid()) {
NS_ERROR("This is not supposed to fail!"); NS_ERROR("This is not supposed to fail!");
} }
@ -1343,7 +1344,7 @@ private:
JSObject *mFlattenedJSObject; JSObject *mFlattenedJSObject;
XPCWrappedNative *mWrapper; XPCWrappedNative *mWrapper;
XPCWrappedNativeTearOff *mTearOff; XPCWrappedNativeTearOff *mTearOff;
char mData[sizeof(XPCCallContext)]; mozilla::AlignedStorage2<XPCCallContext> mData;
}; };
/*************************************************************************** /***************************************************************************