increase user_data reference on gdf copy 89/16589/1
Antoine ELIAS [Thu, 4 Jun 2015 12:00:32 +0000 (14:00 +0200)]
Change-Id: Id2ec16ab46121697543c9b2f18c15d004fd1459a

scilab/modules/graphic_objects/src/cpp/createGraphicObject.cpp

index f03007a..0e30771 100644 (file)
@@ -19,6 +19,7 @@ extern "C"
 #include "FigureModel.h"
 #include "AxesModel.h"
 #include "CurrentSubwin.h"
+#include "api_scilab.h"
 }
 
 #include "CallGraphicController.hxx"
@@ -94,7 +95,11 @@ int createNewFigureWithAxes()
     if (iUserDataSize != 0)
     {
         int* pUserData = NULL;
+
         getGraphicObjectProperty(getFigureModel(), __GO_USER_DATA__, jni_int_vector, (void**)&pUserData);
+
+        increaseValRef(NULL, (int*)*pUserData);
+
         setGraphicObjectProperty(id, __GO_USER_DATA__, pUserData, jni_int_vector, iUserDataSize);
     }