From 0c055a0af876d4f44ebe04ebb744dfc88b2243ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sat, 30 May 2020 02:04:41 +0200 Subject: [PATCH 1/3] Fix conversion of variant list members Item() returns either a Node* or (with wxUSE_STL=1) a compatibility_iterator. While the former is silently and erroneously converted to a Variant using the Variant(void*) overload, the STL flavor fortunately failed. Dereference the Node*/iterator before passing it to wxVariant_out_helper(const Variant&). --- sip/cpp/sip_corewxVariantList.cpp | 2 +- sip/cpp/sip_propgridwxPGVariantList.cpp | 2 +- src/pgvariant.sip | 2 +- src/variant.sip | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sip/cpp/sip_corewxVariantList.cpp b/sip/cpp/sip_corewxVariantList.cpp index 0c9f0f4c..fe9be050 100644 --- a/sip/cpp/sip_corewxVariantList.cpp +++ b/sip/cpp/sip_corewxVariantList.cpp @@ -84,7 +84,7 @@ static PyObject *convertFrom_wxVariantList(void *sipCppV, PyObject *) size_t idx = 0; PyObject* value = PyList_New(0); for (idx=0; idx < sipCpp->GetCount(); idx++) { - PyObject* item = wxVariant_out_helper(sipCpp->Item(idx)); + PyObject* item = wxVariant_out_helper(sipCpp->Item(idx)->GetData()); PyList_Append(value, item); } return value; diff --git a/sip/cpp/sip_propgridwxPGVariantList.cpp b/sip/cpp/sip_propgridwxPGVariantList.cpp index 2c21df45..ca2d0b65 100644 --- a/sip/cpp/sip_propgridwxPGVariantList.cpp +++ b/sip/cpp/sip_propgridwxPGVariantList.cpp @@ -84,7 +84,7 @@ static PyObject *convertFrom_wxPGVariantList(void *sipCppV, PyObject *) size_t idx = 0; PyObject* value = PyList_New(0); for (idx=0; idx < sipCpp->GetCount(); idx++) { - PyObject* item = wxPGVariant_out_helper(sipCpp->Item(idx)); + PyObject* item = wxPGVariant_out_helper(sipCpp->Item(idx)->GetData()); PyList_Append(value, item); } return value; diff --git a/src/pgvariant.sip b/src/pgvariant.sip index 05a2d429..32cd5fe4 100644 --- a/src/pgvariant.sip +++ b/src/pgvariant.sip @@ -182,7 +182,7 @@ PyObject* wxPGVariant_out_helper(const wxVariant& value) size_t idx = 0; PyObject* value = PyList_New(0); for (idx=0; idx < sipCpp->GetCount(); idx++) { - PyObject* item = wxPGVariant_out_helper(sipCpp->Item(idx)); + PyObject* item = wxPGVariant_out_helper(sipCpp->Item(idx)->GetData()); PyList_Append(value, item); } return value; diff --git a/src/variant.sip b/src/variant.sip index c4a53eef..9e2572e7 100644 --- a/src/variant.sip +++ b/src/variant.sip @@ -77,7 +77,7 @@ size_t idx = 0; PyObject* value = PyList_New(0); for (idx=0; idx < sipCpp->GetCount(); idx++) { - PyObject* item = wxVariant_out_helper(sipCpp->Item(idx)); + PyObject* item = wxVariant_out_helper(sipCpp->Item(idx)->GetData()); PyList_Append(value, item); } return value; -- 2.26.2