diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-09-10 05:21:18 -0700 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-09-10 05:21:18 -0700 |
commit | 85507088051bdfabf8bc71346290949b78c3c914 (patch) | |
tree | d3503b8d28ccac78c5b209bea97a094b4a54aeb7 /include/extension.h | |
parent | e220af8dc07d845efb81082f3159460406ece9ca (diff) |
Fixed various crashes because hidden pointers were not persistently stored
Copying the result value of a function has been fixed
New C++ nullptr type is supported for Php::Value
Diffstat (limited to 'include/extension.h')
-rw-r--r-- | include/extension.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/extension.h b/include/extension.h index ad00593..fb33c99 100644 --- a/include/extension.h +++ b/include/extension.h @@ -166,11 +166,15 @@ public: * It is only possible to create functions during the initialization of * the library, before the Extension::module() method is called. * - * @param name Name of the function + * Note that the function must have been allocated on the HEAP (using + * "new") and that the object will be destructed (using "delete") + * by the extension object (you thus do not have to destruct it + * yourself!) + * * @param function The function to add * @return Function The added function */ - Function &add(const char *name, const Function &function); + Function &add(Function *function); /** * Add a native function directly to the extension @@ -200,10 +204,10 @@ public: private: /** - * Map of function objects defined in the library + * Set of function objects defined in the library * @var map */ - std::map<const char *,Function> _functions; + std::set<std::unique_ptr<Function>> _functions; /** * Hidden pointer to self |