Take a look at the generated code from ListBox.cpp: static VALUE _wrap_new_wxListBox__SWIG_0(int argc, VALUE *argv, VALUE self) { VALUE arg1 ; wxWindow *arg2 = (wxWindow *) 0 ; wxWindowID arg3 ; wxPoint *arg4 = 0 ; wxSize *arg5 = 0 ; int arg6 ; wxString *arg7 ; long arg8 ; wxValidator *arg9 = 0 ; wxString *arg10 = 0 ; wxListBox *result; wxString *arr6 ; arg8 has no default value! Here''s the definition from the .h file: wxListBox(wxWindow* parent , wxWindowID id , const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0 , const wxString choices[] = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxT("listBox")); I /thought/ swig pulled the default values from the definition. You can only imagine the havok that is being wreaked through the library if there are uninitialized longs sprinkled about. Is this just a problem with one of our swig config files?
Roy Sutton wrote:> Take a look at the generated code from ListBox.cpp: > > static VALUE > _wrap_new_wxListBox__SWIG_0(int argc, VALUE *argv, VALUE self) { > VALUE arg1 ; > wxWindow *arg2 = (wxWindow *) 0 ; > wxWindowID arg3 ; > wxPoint *arg4 = 0 ; > wxSize *arg5 = 0 ; > int arg6 ; > wxString *arg7 ; > long arg8 ; > wxValidator *arg9 = 0 ; > wxString *arg10 = 0 ; > wxListBox *result; > wxString *arr6 ; > arg8 has no default value!The way I''m reading the code, _wrap_new_wxListBox would only call _wrap_new_wxListBox__SWIG_0 if there were at least 5 parameters, in which case arg8 would be initialized later in that method. I did a quick test with printfs which seemed to confirm this. I don''t like the style of code generated by swig, and especially that it causes warnings under gcc. But it doesn''t look like it will cause any actual runtime problems. Kevin
I''ll double-check this. We''re definitely seeing problems with an uninitialized style value. We''re having the same problem elsewhere with uninitialized values: Check CheckListBox.cpp. This can be called with 5 arguments. If called with exactly five, arg8 will be uninitialized. Roy Kevin Smith wrote:> > The way I''m reading the code, _wrap_new_wxListBox would only call > _wrap_new_wxListBox__SWIG_0 if there were at least 5 parameters, in > which case arg8 would be initialized later in that method. I did a > quick test with printfs which seemed to confirm this. > > I don''t like the style of code generated by swig, and especially that > it causes warnings under gcc. But it doesn''t look like it will cause > any actual runtime problems.
Reasonably Related Threads
- Paging in waves.
- [883] branches/wxruby2/wxwidgets_282/swig: API changes for move to WxWidgets 2.8
- [813] trunk/wxruby2/swig/classes: Added ScrollBar class
- [949] branches/wxruby2/wxwidgets_282: Changes in Gauge API 2.6->2.8, remove comment cruft in header
- question on Choice.i