[mapguide-commits] r7637 - sandbox/jng/node/Oem/SWIGEx/Source/Modules

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 21 09:26:02 PDT 2013


Author: jng
Date: 2013-06-21 09:26:01 -0700 (Fri, 21 Jun 2013)
New Revision: 7637

Modified:
   sandbox/jng/node/Oem/SWIGEx/Source/Modules/nodejs.cxx
Log:
Fix cause of MgException instability. Our exception handling codegen had a separate path for MgObject raw pointers (since they don't inherit from MgDisposable), which inserts a manual pointer release call in the generated catch block after converting MgException contents to v8. Whether this call gets inserted is driven off of a boolean flag in the ExceptionCodeWriter constructor. For non-MgObject classes we declare a Ptr<> to auto-cleanup. Otherwise we just declare a raw MgObject pointer.

We failed to set this flag when the return value code we're generating for is not a MgObject, thus we were getting double-frees because the manual pointer release call was inserted into code blocks where Ptr<> is being used and not the raw MgObject pointer.

Modified: sandbox/jng/node/Oem/SWIGEx/Source/Modules/nodejs.cxx
===================================================================
--- sandbox/jng/node/Oem/SWIGEx/Source/Modules/nodejs.cxx	2013-06-21 16:09:34 UTC (rev 7636)
+++ sandbox/jng/node/Oem/SWIGEx/Source/Modules/nodejs.cxx	2013-06-21 16:26:01 UTC (rev 7637)
@@ -974,7 +974,7 @@
             
             {
                 std::string mbMethodName = Char(overloaded_name_qualified);
-                ExceptionCodeWriter writer(meth, mbMethodName, "MG_TRY", "MG_CATCH", true);   
+                ExceptionCodeWriter writer(meth, mbMethodName, "MG_TRY", "MG_CATCH", isCurrentClassMgObject());   
                 {
                     Indenter ind2(m_indentationLevels);
                     if (parms)



More information about the mapguide-commits mailing list