From 36c342fc7bd78d6334798ead3a8e365dc6fa9434 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 5 Jun 2014 01:22:44 -0700 Subject: [PATCH] Add comment. --- core/logic/smn_database.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/logic/smn_database.cpp b/core/logic/smn_database.cpp index 28574e0a..6971e553 100644 --- a/core/logic/smn_database.cpp +++ b/core/logic/smn_database.cpp @@ -1720,7 +1720,11 @@ static cell_t SQL_ExecuteTransaction(IPluginContext *pContext, const cell_t *par TTransactOp *op = new TTransactOp(db, txn, params[2], pContext->GetIdentity(), onSuccess, onError, data); - // The handle has been cloned in |op|. Close the original. + // The handle owns the underlying Transaction object, but we want to close + // the plugin's view both to ensure reliable access for us and to prevent + // further tamering on the main thread. To do this, TTransactOp clones the + // transaction handle and automatically closes it. Therefore, it's safe to + // close the plugin's handle here. handlesys->FreeHandle(params[2], &sec); IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());