As a first stab at understanding swig''s mem mgmt features, I tried to
fix get_client_data, using Wx::Choice as a testbed.
The attached patch resolves the immediate crasher with this function
(which was b/c the typemap for void* isn''t right for this method). It
also uses the %markfunc feature to prevent objects that are set as
client data from being GC''d. The mini-script attached exercises both
these issues.
It works for me, but there''s still a few issues:
1) Ideally we would implement this in ControlWithItems - but that''s an
abstract class, and the methods are overridden in all the subclasses
(like Choice). Is there a way round this?
2) Adding this seems to cause on segfault on exit/cleanup:
Program received signal EXC_BAD_ACCESS, Could not access memory.
0x00000000 in ?? ()
3) It gives some compile warnings about converting void* to VALUE - I
understand the problem, but I don''t know C++ correct way to cast this.
Hopefully some of this can be useful elsewhere. TIA for your feedback.
alex
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Choice_i.patch
Url:
http://rubyforge.org/pipermail/wxruby-development/attachments/20061101/d4d9a068/attachment-0001.ksh
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: client_data_test.rb
Url:
http://rubyforge.org/pipermail/wxruby-development/attachments/20061101/d4d9a068/attachment-0001.pl