On Sun, Aug 28, 2011 at 4:14 PM, Kai Sterker <kai.ster...@gmail.com> wrote:
> There's a bit of an issue with the python wrappers, however. I tried to make > sure that the wrapper for > window_manager::add takes ownership of the window away from Python. I thought > I had this working > elsewhere, but wasn't able to apply this to window_manager. Might have to ask > on the SWIG mailing list > to find a solution. So for now, one has to manually set thisown = 0 after > adding a window to the > window_manager. Spent some time looking into this and I think it might be a bug or shortcoming of SWIG. The problem lies in applying %feature("shadow") to a static C++ method. It works fine for normal methods, as can be seen in py_rpg.i, but fails to do anything otherwise. It took me a while to come up with a workaround, but I got something in place. Basically, rename the offending static method to something else, then introducing new code with the name of the original method that changes thisown and then calls the renamed method. See here for an example https://github.com/ksterker/adonthell/commit/a8cf4ed83bc236188d2c0a2d11c08b034689ee14#diff-0 I might report this to the SWIG mailing list, but since it seems to be a known problem since quite some time, I don't know how the chances are of getting it fixed. See this bug report from 2009: http://sourceforge.net/mailarchive/message.php?msg_id=23020398 At any rate, it wouldn't really help us, since using this workaround at least offers compatibility to older versions of SWIG. Kai _______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/adonthell-devel