Bug 844996 - DeallocShmem failures will abort in debug builds. r=cjones,benjamin

This commit is contained in:
Benoit Girard 2013-03-27 15:28:57 -04:00
parent cb51c6f934
commit 82b2b0484d

View File

@ -3851,6 +3851,11 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
# bool DeallocShmem(Shmem& mem):
# bool ok = DestroySharedMemory(mem);
##ifdef DEBUG
# if (!ok) {
# NS_RUNTIMEABORT("bad Shmem");
# }
##endif // DEBUG
# mem.forget();
# return ok;
deallocShmem = MethodDefn(MethodDecl(
@ -3859,10 +3864,16 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
ret=Type.BOOL))
okvar = ExprVar('ok')
ifbad = StmtIf(ExprNot(okvar))
ifbad.addifstmt(_runtimeAbort('bad Shmem'))
deallocShmem.addstmts([
StmtDecl(Decl(Type.BOOL, okvar.name),
init=ExprCall(p.destroySharedMemory(),
args=[ memvar ])),
CppDirective('ifdef', 'DEBUG'),
ifbad,
CppDirective('endif', '// DEBUG'),
StmtExpr(_shmemForget(memvar)),
StmtReturn(okvar)
])