diff options
author | Josh Blum | 2013-07-07 22:46:18 -0700 |
---|---|---|
committer | Josh Blum | 2013-07-07 22:46:18 -0700 |
commit | d4d411ba6103f3075b7270d741bc5df406714d54 (patch) | |
tree | e440f098617b064c299f13aab91e92dcf37dfd30 | |
parent | dd3872720fcd35dc6e9e95eb597901902bea1ec5 (diff) | |
download | sandhi-d4d411ba6103f3075b7270d741bc5df406714d54.tar.gz sandhi-d4d411ba6103f3075b7270d741bc5df406714d54.tar.bz2 sandhi-d4d411ba6103f3075b7270d741bc5df406714d54.zip |
gras: %newobject for factory gives python ownership
-rw-r--r-- | python/gras/GRAS_Factory.i | 2 | ||||
-rw-r--r-- | tests/example_module.cpp | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/python/gras/GRAS_Factory.i b/python/gras/GRAS_Factory.i index b3ba44b..01b51b9 100644 --- a/python/gras/GRAS_Factory.i +++ b/python/gras/GRAS_Factory.i @@ -13,6 +13,8 @@ namespace gras %ignore Factory::make; } +%newobject gras::Factory::_handle_make; + //////////////////////////////////////////////////////////////////////// // Export swig element comprehension //////////////////////////////////////////////////////////////////////// diff --git a/tests/example_module.cpp b/tests/example_module.cpp index 2186973..2191650 100644 --- a/tests/example_module.cpp +++ b/tests/example_module.cpp @@ -2,6 +2,7 @@ #include <gras/block.hpp> #include <gras/factory.hpp> +#include <iostream> struct MyBlock : gras::Block { @@ -11,6 +12,11 @@ struct MyBlock : gras::Block this->register_call("get_num", &MyBlock::get_num); } + ~MyBlock(void) + { + std::cout << "~MyBlock" << std::endl; + } + int get_num(void) { return 42; |