Permalink
Browse files

Move the call to end_request to before the context is destroyed

Fixes az://322

The way the code was on sm_stop, the driver's shutdown routine, was
destroying the VM context before calling end_request, which was
operating on the context. This simple change simply calls end_request
before the context is destroyed.
  • Loading branch information...
1 parent 40d0982 commit 017144c1ac61280ff72ac26342ff7b884cbe7b5a @Vagabond Vagabond committed Apr 22, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 c_src/spidermonkey.c
View
@@ -178,6 +178,8 @@ void sm_stop(spidermonkey_vm *vm) {
sleep(1);
}
+ end_request(vm);
+
//Now we should be free to proceed with
//freeing up memory without worrying about
//crashing the VM.
@@ -190,7 +192,6 @@ void sm_stop(spidermonkey_vm *vm) {
JS_SetContextPrivate(vm->context, NULL);
JS_DestroyContext(vm->context);
JS_DestroyRuntime(vm->runtime);
- end_request(vm);
driver_free(vm);
}

0 comments on commit 017144c

Please sign in to comment.