Re: [pygccxml-development] Parameter passing, ownership semantics
Brought to you by:
mbaas,
roman_yakovenko
From: Gustavo C. <gjc...@gm...> - 2007-02-24 18:34:36
|
On 2/24/07, Gustavo Carneiro <gjc...@gm...> wrote: > > On 2/22/07, Roman Yakovenko <rom...@gm...> wrote: > > Also I added new functionality, which allows you to implement the patch: > > http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/unittests/transfer_ownership_tester.py?view=markup > > > > http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/unittests/data/transfer_ownership_to_be_exported.hpp?view=markup > > > > > Thanks, it works perfectly! :-) > Bah, I spoke a little too soon :P It seems that when the virtual method is protected, as shown in the patch below, the "method.add_override_precall_code()" part stops having any effect on the generated virtual method code, and so the INCREF is not inserted, making the memory problem come back. And it so happens that the code I am trying to wrap hits precisely this bug... what a bad luck :( --- simulator.hpp 2007-02-19 12:55:53.000000000 +0000 +++ simulator-new.hpp 2007-02-24 18:29:12.000000000 +0000 @@ -7,6 +7,10 @@ namespace ns3 { class EventImpl { public: + void Invoke(void) { + Notify(); + } +protected: virtual void Notify() = 0; }; @@ -18,7 +22,7 @@ public: }; static void Run() { - Simulator::event->Notify(); + Simulator::event->Invoke(); delete Simulator::event; Simulator::event = 0; }; -- Gustavo J. A. M. Carneiro "The universe is always one step beyond logic." |