[wxruby-users] GenericDirCtrl Bus Error crash on OSX

Mathias Bruce mathias.bruce at gmail.com
Mon Nov 10 20:06:04 EST 2008


On Tue, Nov 11, 2008 at 1:36 AM, Alex Fenton <alex at pressure.to> wrote:
> Mathias Bruce wrote:
>>
>> In my program I use a GenericDirCtrl and handle its corresponding
>> TreeCtrl item selection event with evt_tree_sel_changed.
>> In the method handling this event, I try to get at the data of the
>> selected item, but I run into this:
>>
>> ./my_xrcise_frames.rb:43: [BUG] Bus Error
>> ruby 1.8.6 (2008-03-03) [universal-darwin9.0]
>>
>> Abort trap
>>
>> The code for the event handling method is as follows, where
>> gdc_browse_tree is the GenericDirCtrl instance:
>>
>> def on_browse_tree_sel_changed(tree_event)
>>  item_id = tree_event.get_item
>>  raise 'item_id was zero' if item_id == 0
>>  tc = gdc_browse_tree.get_tree_ctrl
>>  item_data = tc.get_item_data(item_id)
>>  raise 'item_data was nil' if item_data == nil
>> end
>>
>
> Thanks for reporting this. I think it's a bug. In a normal Wx::TreeCtrl
> get_item_data works fine, but the item data held by a TreeCtrl associated
> with a GenericDirCtrl isn't a valid ruby object. We can fix this, and it
> would be helpful to understand what you were trying to do here.
>
> Could you say what you expected to get from calling get_item_data here
> please? The GenericDirCtrl  already has methods (eg get_path, get_file_path)
> that will return the value of the currently selected directory.
>
> BTW, it's very much appreciated if you can demonstrate a problem in a
> minimal, self-contained, runnable sample, rather than just a isolated
> snippet. That saves those looking into it having to guess how to reproduce
> the context of the problem.
>
> thanks
> alex
> _______________________________________________
> wxruby-users mailing list
> wxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wxruby-users
>

Thanks for the quick reply! I apparently misread the docs gravely, and
got the impression that I had to pick the selected path from the item
itself. GenericDirCtrl.get_path does exactly what I needed... Sorry
for wasting your time =o)

I read on the website about you preferring self-contained error
reproduction code, and I completely understand that. The only reason I
didn't do that was because I'm using XRC and xrcise, so (I think) it
would have been 2-3 separate files, in which case it would be easier
to file a bug in the tracker and put them there. I just thought I'd
find out if the problem was wxruby-related or not, first.

If you still want a little package of code reproducing the error, then
I'll absolutely cook it up, but you don't need to extend the bindings
for my sake anymore, since as you correctly suspected I didn't really
need the item data - and maybe no one else will either... =o)

Thanks again,
Mathias


More information about the wxruby-users mailing list