wxPyDataViewCustomRenderer::GetValueFromEditorCtrl has wrong signature

Pete Allinson <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
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.py has 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 GetValueFromEditorCtrl instead of the wxPyDataViewCustomRenderer class 
version.

The base class version of GetValueFromEditorCtrl  simply 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 GetValueFromEditorCtrl gets 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,
Pete

-- 
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.