From 0425a61fa8b53aa25f360c045bc737202d82aea8 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 23 Jan 2020 18:03:22 +0000 Subject: [PATCH] shared_ptr upcast fixes for D Same changes that were applied to Java/C# in ab7f526805b86726a3c23c853e0ab19458f2c7d9 --- Source/Modules/d.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Modules/d.cxx b/Source/Modules/d.cxx index 5e82dfda3..af850ebbd 100644 --- a/Source/Modules/d.cxx +++ b/Source/Modules/d.cxx @@ -3378,14 +3378,16 @@ private: upcast_wrapper_name); if (smart) { - SwigType *bsmart = Copy(smart); + String *smartnamestr = SwigType_namestr(smart); + String *bsmartnamestr = SwigType_namestr(smart); + SwigType *rclassname = SwigType_typedef_resolve_all(c_class_name); SwigType *rbaseclass = SwigType_typedef_resolve_all(c_base_name); - Replaceall(bsmart, rclassname, rbaseclass); + Replaceall(bsmartnamestr, rclassname, rbaseclass); + Delete(rclassname); Delete(rbaseclass); - String *smartnamestr = SwigType_namestr(smart); - String *bsmartnamestr = SwigType_namestr(bsmart); + Printv(upcasts_code, "SWIGEXPORT ", bsmartnamestr, " * ", upcast_wrapper_name, "(", smartnamestr, " *objectRef) {\n", @@ -3394,7 +3396,6 @@ private: "\n", NIL); Delete(bsmartnamestr); Delete(smartnamestr); - Delete(bsmart); } else { Printv(upcasts_code, "SWIGEXPORT ", c_base_name, " * ", upcast_wrapper_name,