aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-09-15 18:08:25 +0300
committermax99x <max99x@gmail.com>2011-09-15 18:08:25 +0300
commit76c15819b22aca811e70127d82e146afa33036f4 (patch)
tree2ddfabe609c907a3729e716407e8d1156bbff43c /src
parenta39cbaf4f3d6da7122a83697d29e4ff3fc71ddfb (diff)
Fixed unbound calling of destructor in exception handler; updated test.
Diffstat (limited to 'src')
-rw-r--r--src/library.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/library.js b/src/library.js
index 156c1c25..a628e323 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4044,18 +4044,20 @@ LibraryManager.library = {
}
// Clear state flag.
__THREW__ = false;
- // Free ptr if it isn't null.
- if ({{{ makeGetValue('_llvm_eh_exception.buf', '0', 'void*') }}}) {
- ___cxa_free_exception({{{ makeGetValue('_llvm_eh_exception.buf', '0', 'void*') }}});
- {{{ makeSetValue('_llvm_eh_exception.buf', '0', '0', 'void*') }}}
- }
// Clear type.
{{{ makeSetValue('_llvm_eh_exception.buf', '4', '0', 'void*') }}}
// Call destructor if one is registered then clear it.
- if ({{{ makeGetValue('_llvm_eh_exception.buf', '8', 'void*') }}}) {
- FUNCTION_TABLE[{{{ makeGetValue('_llvm_eh_exception.buf', '8', 'void*') }}}]();
+ var ptr = {{{ makeGetValue('_llvm_eh_exception.buf', '0', 'void*') }}};
+ var destructor = {{{ makeGetValue('_llvm_eh_exception.buf', '8', 'void*') }}};
+ if (destructor) {
+ FUNCTION_TABLE[destructor](ptr);
{{{ makeSetValue('_llvm_eh_exception.buf', '8', '0', 'i32') }}}
}
+ // Free ptr if it isn't null.
+ if (ptr) {
+ ___cxa_free_exception(ptr);
+ {{{ makeSetValue('_llvm_eh_exception.buf', '0', '0', 'void*') }}}
+ }
},
__cxa_get_exception_ptr__deps: ['llvm_eh_exception'],
__cxa_get_exception_ptr: function(ptr) {