# fillItems() method - segmentation fault solved

**URL:** <https://www.ruby-forum.com/t/fillitems-method-segmentation-fault-solved/186061>\
**Category:** FXRuby\
**Created:** [March 31, 2010, 3:17am UTC](https://www.ruby-forum.com/t/fillitems-method-segmentation-fault-solved/186061 "2010-03-31T03:17:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/96bed5/32.png) [@alexd](https://www.ruby-forum.com/u/alexd)\
**Post date:** [March 31, 2010, 3:17am UTC](https://www.ruby-forum.com/t/fillitems-method-segmentation-fault-solved/186061/1 "2010-03-31T03:17:44Z")

</div>

I had an FXRuby app that was randomly segfaulting at the following code  
line:

listbox.clearItems()  
listbox.fillItems(some\_string\_array)

It would segfault when executing .fillItems, but the segfault was  
unpredictable and seemingly without reason. After weeks of struggle, I  
discovered that if instead I do:

listbox.clearItems()  
some\_string\_array.each { |item| listbox.appendItem(item) }

the code works fine and never segfaults. So, the issue seems to be  
somewhere in the .fillItems method.

Anyway, I thought I’d post this in case others experience problems with  
the .fillItems method.

–Alex
