Merge PR #489: Do not call functions in paused plugins

This should be reverted when pausing is removed, see PR discussion.
This commit is contained in:
Asher Baker 2016-10-03 16:51:45 +01:00
commit 215599b90f
2 changed files with 44 additions and 20 deletions

View File

@ -252,6 +252,9 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
if (filter)
filter->Preprocess(func, temp_info);
if (func->GetParentRuntime()->IsPaused())
continue;
for (unsigned int i=0; i<num_params; i++)
{
int err = SP_ERROR_PARAM;

View File

@ -237,6 +237,9 @@ public:
}
void CancelThinkPart()
{
if (!m_pFunction->IsRunnable())
return;
m_pFunction->PushCell(BAD_HANDLE);
m_pFunction->PushCell(BAD_HANDLE);
m_pFunction->PushString("Driver is unloading");
@ -267,11 +270,14 @@ public:
}
}
m_pFunction->PushCell(m_MyHandle);
m_pFunction->PushCell(qh);
m_pFunction->PushString(qh == BAD_HANDLE ? error : "");
m_pFunction->PushCell(m_Data);
m_pFunction->Execute(NULL);
if (m_pFunction->IsRunnable())
{
m_pFunction->PushCell(m_MyHandle);
m_pFunction->PushCell(qh);
m_pFunction->PushString(qh == BAD_HANDLE ? error : "");
m_pFunction->PushCell(m_Data);
m_pFunction->Execute(NULL);
}
if (qh != BAD_HANDLE)
{
@ -335,9 +341,11 @@ public:
void CancelThinkPart()
{
if (m_pDatabase)
{
m_pDatabase->Close();
}
if (!m_pFunction->IsRunnable())
return;
if (m_ACM == ACM_Old)
m_pFunction->PushCell(BAD_HANDLE);
m_pFunction->PushCell(BAD_HANDLE);
@ -349,6 +357,13 @@ public:
{
Handle_t hndl = BAD_HANDLE;
if (!m_pFunction->IsRunnable())
{
if (m_pDatabase)
m_pDatabase->Close();
return;
}
if (m_pDatabase)
{
if ((hndl = g_DBMan.CreateHandle(DBHandle_Database, m_pDatabase, me->GetIdentity()))
@ -1678,12 +1693,15 @@ private:
data[i] = txn_->entries[i].data;
}
success_->PushCell(dbh);
success_->PushCell(data_);
success_->PushCell(txn_->entries.length());
success_->PushArray(handles.get(), results_.length());
success_->PushArray(data.get(), results_.length());
success_->Execute(NULL);
if (success_->IsRunnable())
{
success_->PushCell(dbh);
success_->PushCell(data_);
success_->PushCell(txn_->entries.length());
success_->PushArray(handles.get(), results_.length());
success_->PushArray(data.get(), results_.length());
success_->Execute(NULL);
}
// Cleanup. Note we clear results_, since freeing their handles will
// call Destroy(), and we don't want to double-free in ~TTransactOp.
@ -1722,13 +1740,16 @@ public:
db_->AddRef();
}
failure_->PushCell(dbh);
failure_->PushCell(data_);
failure_->PushCell(txn_->entries.length());
failure_->PushString(error_.chars());
failure_->PushCell(failIndex_);
failure_->PushArray(data.get(), txn_->entries.length());
failure_->Execute(NULL);
if (failure_->IsRunnable())
{
failure_->PushCell(dbh);
failure_->PushCell(data_);
failure_->PushCell(txn_->entries.length());
failure_->PushString(error_.chars());
failure_->PushCell(failIndex_);
failure_->PushArray(data.get(), txn_->entries.length());
failure_->Execute(NULL);
}
handlesys->FreeHandle(dbh, &sec);
}