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
Родитель e8aa91a4a3
Коммит 2e9c45b7dc
1 изменённых файлов: 11 добавлений и 0 удалений

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

@ -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)
])