Pecan deserves the find-most-stupid-random-crash-bug-2012 award. It's exactly as you say,
wxArray::Remove(T&) retrieves the index of the element to be removed by comparing every item in the array against the to-be-removed item. It's a real pain to verify that, digging through 5 indirections of wx-macro-crap, but actually, if you think about it, that's kind of obvious -- there is hardly any other way it could be.
Thus, it's dereferencing unallocated memory, which sometimes works and sometimes crashes. The
delete must be after
Remove.
Commit your change please?