From d6e8fa6b454cfa703fc9ad86dd3d14c99bb6eb27 Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Wed, 13 May 2020 09:30:43 +0300 Subject: [PATCH] Fix the compilation error by reverting "Fix crashes in unit-tests related to incorrect message processing from Python." and making the conversion of messages without shared_ptr. This reverts commit da6063794500a9eef94e628e40d9155f55cbf3f7. --- src/Events/Events.i | 5 ----- src/ModelAPI/ModelAPI.i | 7 +++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Events/Events.i b/src/Events/Events.i index c623fd1e4..e395be12e 100644 --- a/src/Events/Events.i +++ b/src/Events/Events.i @@ -43,15 +43,10 @@ // standard definitions %include "typemaps.i" %include "std_string.i" -%include "std_shared_ptr.i" // directors %feature("director") Events_Listener; -%shared_ptr(Events_InfoMessage) -%shared_ptr(Events_Message) -%shared_ptr(Events_MessageGroup) - // all supported interfaces %include "Events_Message.h" %include "Events_InfoMessage.h" diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index ca786a2a6..068fd4d7a 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -97,7 +97,6 @@ %shared_ptr(ModelAPI_ResultField) %shared_ptr(ModelAPI_ResultParameter) %shared_ptr(ModelAPI_ResultCompSolid) -%shared_ptr(ModelAPI_ObjectUpdatedMessage) %typecheck(SWIG_TYPECHECK_POINTER) const ModelAPI_AttributeTables::Value { $1 = (PyFloat_Check($input) || PyLong_Check($input) || PyUnicode_Check($input) || PyBool_Check($input)) ? 1 : 0; @@ -197,7 +196,11 @@ template std::shared_ptr shared_ptr_cast(std::shared_ptr %template(modelAPI_ResultGroup) shared_ptr_cast; %template(modelAPI_ResultField) shared_ptr_cast; -%template(messageToUpdatedMessage) shared_ptr_cast; +%inline %{ + ModelAPI_ObjectUpdatedMessage* messageToUpdatedMessage(std::shared_ptr msg) { + return static_cast(msg.get()); + } +%} // Attribute casts %template(modelAPI_AttributeDocRef) shared_ptr_cast; -- 2.39.2