Browse Source

interrogate: Fix __setstate__ not working for subclasses

rdb 5 years ago
parent
commit
1793c9a938
1 changed files with 2 additions and 2 deletions
  1. 2 2
      dtool/src/interrogate/interfaceMakerPythonNative.cxx

+ 2 - 2
dtool/src/interrogate/interfaceMakerPythonNative.cxx

@@ -3624,8 +3624,8 @@ write_function_for_name(ostream &out, Object *obj,
       error_return(out, 4, return_flags);
       error_return(out, 4, return_flags);
       out << "  }\n"
       out << "  }\n"
           << "  " << cClassName << " *local_this = new " << cClassName << ";\n"
           << "  " << cClassName << " *local_this = new " << cClassName << ";\n"
-          << "  DTool_PyInit_Finalize(self, local_this, &Dtool_" << ClassName
-          << ", false, false);\n"
+          << "  DTool_PyInit_Finalize(self, local_this, "
+          << "((Dtool_PyInstDef *)self)->_My_Type, false, false);\n"
           << "  if (local_this == nullptr) {\n"
           << "  if (local_this == nullptr) {\n"
           << "    PyErr_NoMemory();\n";
           << "    PyErr_NoMemory();\n";
     }
     }