diff --git a/src/gsi/gsi/gsiCallback.h b/src/gsi/gsi/gsiCallback.h index e3903cd5a..e37621823 100644 --- a/src/gsi/gsi/gsiCallback.h +++ b/src/gsi/gsi/gsiCallback.h @@ -41,6 +41,7 @@ struct GSI_PUBLIC Callee virtual ~Callee () { } virtual void call (int id, SerialArgs &args, SerialArgs &ret) const = 0; + virtual bool can_call () const { return true; } }; /** @@ -72,7 +73,7 @@ struct Callback bool can_issue () const { - return callee.get () != 0; + return callee && callee->can_call (); } // 0 arguments diff --git a/src/pya/pya/pyaObject.cc b/src/pya/pya/pyaObject.cc index 9ddd7172e..3ed8d126d 100644 --- a/src/pya/pya/pyaObject.cc +++ b/src/pya/pya/pyaObject.cc @@ -76,6 +76,11 @@ public: */ virtual void call (int id, gsi::SerialArgs &args, gsi::SerialArgs &ret) const; + /** + * @brief Implementation of the Callee interface + */ + virtual bool can_call () const; + private: PYAObjectBase *mp_obj; std::vector m_cbfuncs; @@ -108,6 +113,12 @@ Callee::clear_callbacks () m_cbfuncs.clear (); } +bool +Callee::can_call () const +{ + return pya::PythonInterpreter::instance () != 0; +} + void Callee::call (int id, gsi::SerialArgs &args, gsi::SerialArgs &ret) const { diff --git a/src/rba/rba/rba.cc b/src/rba/rba/rba.cc index 8ebf6c12f..1d0ee282e 100644 --- a/src/rba/rba/rba.cc +++ b/src/rba/rba/rba.cc @@ -1728,8 +1728,7 @@ RubyInterpreter::~RubyInterpreter () rb_release_top_self (); - // This prevents reinitialization - sp_rba_interpreter = reinterpret_cast (1); + sp_rba_interpreter = 0; } RubyInterpreter *RubyInterpreter::instance () diff --git a/src/rba/rba/rbaInspector.cc b/src/rba/rba/rbaInspector.cc index 26ffa7aab..70a7c9865 100644 --- a/src/rba/rba/rbaInspector.cc +++ b/src/rba/rba/rbaInspector.cc @@ -132,7 +132,7 @@ public: : m_hash (hash) { rb_gc_register_address (&m_hash); - m_keys = rb_ary_new2 (RHASH_SIZE (m_hash)); + m_keys = rb_ary_new2 (long (RHASH_SIZE (m_hash))); rb_gc_register_address (&m_keys); rb_hash_foreach (m_hash, (int (*)(...)) &push_key_to_ary_i, m_keys); } diff --git a/src/rba/rba/rbaInternal.cc b/src/rba/rba/rbaInternal.cc index d6d8dc302..2b9e2dcfd 100644 --- a/src/rba/rba/rbaInternal.cc +++ b/src/rba/rba/rbaInternal.cc @@ -301,6 +301,11 @@ Proxy::signal_handler (const gsi::MethodBase *meth) return sh; } +bool Proxy::can_call () const +{ + return rba::RubyInterpreter::instance () != 0; +} + void Proxy::call (int id, gsi::SerialArgs &args, gsi::SerialArgs &ret) const { diff --git a/src/rba/rba/rbaInternal.h b/src/rba/rba/rbaInternal.h index 4957e5881..cca746f6d 100644 --- a/src/rba/rba/rbaInternal.h +++ b/src/rba/rba/rbaInternal.h @@ -147,6 +147,7 @@ public: VALUE signal_handler (const gsi::MethodBase *meth); virtual void call (int id, gsi::SerialArgs &args, gsi::SerialArgs &ret) const; + virtual bool can_call () const; private: const gsi::ClassBase *m_cls_decl; diff --git a/src/rbastub/rba.cc b/src/rbastub/rba.cc index 42179c1db..189e7d23c 100644 --- a/src/rbastub/rba.cc +++ b/src/rbastub/rba.cc @@ -41,8 +41,7 @@ RubyInterpreter::RubyInterpreter () RubyInterpreter::~RubyInterpreter () { - // This prevents reinitialization - sp_rba_interpreter = reinterpret_cast (1); + sp_rba_interpreter = 0; } RubyInterpreter *RubyInterpreter::instance ()