Skip to content

Commit

Permalink
fix AndroidNativePythonService addAndroidCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
irov committed Aug 14, 2023
1 parent 38621e5 commit f349da3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Mengine
SERVICE_DECLARE( "AndroidNativePythonService" )

public:
virtual void addAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb, const pybind::args & _args ) = 0;
virtual pybind::object addAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb, const pybind::args & _args ) = 0;
virtual void removeAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb ) = 0;

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ namespace Mengine
namespace Detail
{
///////////////////////////////////////////////////////////////////////
static void AndroidNativePythonService_addAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb, const pybind::args & _args )
static pybind::object AndroidNativePythonService_addAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb, const pybind::args & _args )
{
ANDROID_NATIVEPYTHON_SERVICE()
pybind::object cb = ANDROID_NATIVEPYTHON_SERVICE()
->addAndroidCallback( _plugin, _method, _cb, _args );

return cb;
}
///////////////////////////////////////////////////////////////////////
static void AndroidNativePythonService_removeAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ namespace Mengine
m_plugins.emplace( _name, _plugin );
}
//////////////////////////////////////////////////////////////////////////
void AndroidNativePythonService::addAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb, const pybind::args & _args )
pybind::object AndroidNativePythonService::addAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb, const pybind::args & _args )
{
MapAndroidCallbacks::iterator it_found = m_callbacks.find( Utility::make_pair( _plugin, _method ) );

Expand All @@ -330,6 +330,8 @@ namespace Mengine
desc.args = _args;

callbacks.emplace_back( desc );

return _cb;
}
//////////////////////////////////////////////////////////////////////////
void AndroidNativePythonService::removeAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace Mengine
void activateSemaphore( const ConstString & _name ) override;

public:
void addAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb, const pybind::args & _args ) override;
pybind::object addAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb, const pybind::args & _args ) override;
void removeAndroidCallback( const ConstString & _plugin, const ConstString & _method, const pybind::object & _cb ) override;

public:
Expand Down

0 comments on commit f349da3

Please sign in to comment.