Tonight, I started to look into why wxruby2 crashes so much. I found
that the minimal, image, and calendar samples can run and exit without
crashing. But several other samples, such as caret, would crash upon exit.
A quick gdb stacktrace showed that ruby was attempting to free an object
that wx had already deleted. We have protection against that (added
post-swig by fixdeleting.rb), but it wasn''t working in this case for
wxCaret. Turns out that our wxCaret.h didn''t have any virtual methods,
so swig wasn''t creating a director class, and fixdeleting only works
for
classes that have directors.
In this case, it turned out the wxCaret docs incorrectly omitted the
virtual keyword from two methods. I added virtual where it belonged, and
suddenly the caret sample can exit without crashing.
I am now optimistic that many/most/all of the segfault crashes will be
solved the same way. Basically, we cannot have any wx classes without
directors. In many cases, we will find that the docs simply left out
some virtual keywords, and adding them will fix those classes. If there
really are no virtual methods (which is true of some classes), we''ll
have to add one.
Hopefully we''ll be able to just declare the destructor virtual somehow.
If not, hopefully we''ll be able to use %extend. Worst case,
we''ll tweak
the wxXxx.h files, with #if statements around our extra bits so the
headers will still represent pure wx.
Kevin