From 403e56817a03123e8a7f3c64868d73a962cb52f9 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 26 Jan 2019 19:22:44 +0100 Subject: [PATCH 1/2] dtoolbase: fix x86 compilation error on Android --- dtool/src/dtoolbase/atomicAdjustI386Impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtool/src/dtoolbase/atomicAdjustI386Impl.h b/dtool/src/dtoolbase/atomicAdjustI386Impl.h index bcd1a62c61..4daa335b2a 100644 --- a/dtool/src/dtoolbase/atomicAdjustI386Impl.h +++ b/dtool/src/dtoolbase/atomicAdjustI386Impl.h @@ -17,7 +17,7 @@ #include "dtoolbase.h" #include "selectThreadImpl.h" -#if (defined(__i386__) || defined(_M_IX86)) && !defined(__APPLE__) +#if (defined(__i386__) || defined(_M_IX86)) && !defined(__APPLE__) && !defined(__ANDROID__) #include "numeric_types.h" From 376cef51c494fa2e4514d757b88eec9f069445cd Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 26 Jan 2019 19:26:56 +0100 Subject: [PATCH 2/2] interrogate: fix Python 3 crash with optional std::wstring args This would cause PyMem_Free to be called on an uninitialized pointer if a default argument was not specified. Fixes #542 --- dtool/src/interrogate/interfaceMakerPythonNative.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index ca2ed7eb8d..5f351dbbc1 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -4701,7 +4701,7 @@ write_function_instance(ostream &out, FunctionRemap *remap, if (is_optional) { extra_convert - << "wchar_t *" << param_name << "_str;\n" + << "wchar_t *" << param_name << "_str = nullptr;\n" << "if (" << param_name << " != nullptr) {\n" << "#if PY_VERSION_HEX >= 0x03030000\n" << " " << param_name << "_str = PyUnicode_AsWideCharString(" << param_name << ", nullptr);\n" @@ -4748,7 +4748,7 @@ write_function_instance(ostream &out, FunctionRemap *remap, if (is_optional) { extra_convert << "Py_ssize_t " << param_name << "_len;\n" - << "wchar_t *" << param_name << "_str;\n" + << "wchar_t *" << param_name << "_str = nullptr;\n" << "std::wstring " << param_name << "_wstr;\n" << "if (" << param_name << " != nullptr) {\n" << "#if PY_VERSION_HEX >= 0x03030000\n"