Skip to content

Commit 1d8509f

Browse files
committed
-- destructor-fix --
1 parent 88b0f94 commit 1d8509f

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

pyMOOS.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ class AsyncCommsWrapper : public MOOS::MOOSAsyncCommClient {
4545
private:
4646
typedef MOOSAsyncCommClient BASE;
4747
public:
48+
49+
~AsyncCommsWrapper(){
50+
//AsyncCommsWrapper::Close(true);
51+
//BASE::~BASE();
52+
Py_BEGIN_ALLOW_THREADS
53+
//PyGILState_STATE gstate = PyGILState_Ensure();
54+
BASE::Close(true);
55+
//PyGILState_Release(gstate);
56+
Py_END_ALLOW_THREADS
57+
58+
}
59+
4860

4961
bool Run(const std::string & sServer, int Port, const std::string & sMyName) {
5062
return BASE::Run(sServer, Port, sMyName, 0);//Comms Tick not used in Async version
@@ -81,13 +93,12 @@ class AsyncCommsWrapper : public MOOS::MOOSAsyncCommClient {
8193
return true;
8294
}
8395

84-
bool Close(bool nice)
85-
{
86-
Py_BEGIN_ALLOW_THREADS
87-
//PyGILState_STATE gstate = PyGILState_Ensure();
88-
BASE::Close(nice);
89-
//PyGILState_Release(gstate);
90-
Py_END_ALLOW_THREADS
96+
bool Close(bool nice){
97+
Py_BEGIN_ALLOW_THREADS
98+
//PyGILState_STATE gstate = PyGILState_Ensure();
99+
this->BASE::~BASE();
100+
//PyGILState_Release(gstate);
101+
Py_END_ALLOW_THREADS
91102
}
92103

93104

0 commit comments

Comments
 (0)