Finalize the instance before the delete. Bug found by scan-build (llvm + clang) 29/12729/2
Sylvestre Ledru [Sat, 28 Sep 2013 10:44:42 +0000 (12:44 +0200)]
Change-Id: I04c4ac99e47a126da6214c8bb1708aace3faf5bf

scilab/modules/external_objects_java/src/cpp/ScilabJavaEnvironment.cpp

index fb43393..806fb43 100644 (file)
@@ -77,9 +77,9 @@ void ScilabJavaEnvironment::finish()
     {
         ScilabEnvironments::unregisterScilabEnvironment(envId);
         envId = -1;
+        instance->Finalize();
         delete instance;
         instance = 0;
-        instance->Finalize();
         usable = false;
     }
 }