Re: wxPyDataViewCustomRenderer::GetValueFromEditorCtrl has wrong signature
Robin Dunn <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
Pete Allinson wrote: > Hi All, > > I recently ran into a problem with a DataViewCustomRenderer wherein > Python would crash during the call to FinishEditing. On further > investigation it turns out that demo/DVC_CustomRenderer.pyhas the same > problem. > > I believe the problem lies in the signature of function > wxPyDataViewCustomRenderer::GetValueFromEditorCtrl in file > dataview_wrap.cpp. The signature is: > > virtual bool GetValueFromEditorCtrl(wxControl * editor, > wxVariant& value) > > but that is inconsistent with the signature of the base class. As a > result, wxDataViewRendererBase::FinishEditing() calls the base class > version of GetValueFromEditorCtrlinstead of the > wxPyDataViewCustomRenderer class version. > > The base class version of GetValueFromEditorCtrlsimply returns false and > leaves the wxVariant uninitialized. This garbage value is subsequently > passed to ChangeValue()where it leads to an exception and crash. > > I believe the correct signature for > wxPyDataViewCustomRenderer::GetValueFromEditorCtrl is: > > virtual bool GetValueFromEditorCtrl(wxWindow * editor, > wxVariant& value) > > (i.e. wxControl -> wxWindow) > > I've tested this change on Windows 8.1, 32 and 64 bit wxPython 3.0.2. > The correct version of GetValueFromEditorCtrlgets called, and > demo/DVC_CustomRenderer.py behaves as it should. > > I've not tested other OS builds (OSX, GTK) but appear to also have > incorrect signatures for GetValueFromEditorCtrl Thanks. The fix for CLassic will be easy, but I'm not sure when there will be a new release. I'll need to take a closer look for how to take care of the problem in Phoenix. -- Robin Dunn Software Craftsman http://wxPython.org -- You received this message because you are subscribed to the Google Groups "wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.