From ae37a8da89d3447f6339930bd83eaded65a07024 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 25 Apr 2012 09:09:08 +0200 Subject: [PATCH] Bug 747870 - Properly align XPCLazyCallContext::mData. r=bholley --- js/xpconnect/src/xpcprivate.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 8a86ebf2c7c..b576bbdfb52 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -1310,12 +1310,13 @@ public: XPCCallContext &GetXPCCallContext() { if (!mCcx) { + XPCCallContext *data = mData.addr(); mCcxToDestroy = mCcx = - new (mData) XPCCallContext(mCallerLanguage, mCx, - mCallBeginRequest == CALL_BEGINREQUEST, - mObj, - mFlattenedJSObject, mWrapper, - mTearOff); + new (data) XPCCallContext(mCallerLanguage, mCx, + mCallBeginRequest == CALL_BEGINREQUEST, + mObj, + mFlattenedJSObject, mWrapper, + mTearOff); if (!mCcx->IsValid()) { NS_ERROR("This is not supposed to fail!"); } @@ -1343,7 +1344,7 @@ private: JSObject *mFlattenedJSObject; XPCWrappedNative *mWrapper; XPCWrappedNativeTearOff *mTearOff; - char mData[sizeof(XPCCallContext)]; + mozilla::AlignedStorage2 mData; }; /***************************************************************************