diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2015-02-05 22:59:15 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2015-02-05 22:59:15 +0100 |
commit | 7c7121e92b3ebd2763b4b03227eeec09461d8ea9 (patch) | |
tree | d4de14152798da46907795e773feac742d27a769 /zend/function.cpp | |
parent | ba32a85db3f1130d01ccf228e253d2e717c53c70 (diff) |
refactored the initialization and shutdown of extension objects (code is moved from a static method to a real member method), and more importantly: fixed initialization of the PhpCpp::Functor class, previously, we created the class an runtime whenever we needed it, but that turned out to be a cause for crashes when php stopped, this has also been solved
Diffstat (limited to 'zend/function.cpp')
-rw-r--r-- | zend/function.cpp | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/zend/function.cpp b/zend/function.cpp index 01267c0..dddc489 100644 --- a/zend/function.cpp +++ b/zend/function.cpp @@ -18,32 +18,10 @@ namespace Php { /** - * Function returns a pointer to the class-entry of the Functor class - * @return zend_class_entry - */ -zend_class_entry *Function::entry() -{ - // and the actual class entry - static zend_class_entry *entry = nullptr; - - // is the class entry already valid? - if (entry) return entry; - - // construct functor object - static std::unique_ptr<ClassBase> functor(new Class<Functor>("Functor")); - - // we need the TSRMLS variable - TSRMLS_FETCH(); - - // initialize the functor class - return entry = functor->implementation()->initialize(functor.get(), "" TSRMLS_CC); -} - -/** * Constructor * @param function The function to be wrapped */ -Function::Function(const std::function<Php::Value(Php::Parameters&)> &function) : Value(Object(entry(), new Functor(function))) {} +Function::Function(const std::function<Php::Value(Php::Parameters&)> &function) : Value(Object(Functor::entry(), new Functor(function))) {} /** * End of namespace |