update to NormSession::DeleteTxObject() to close file for NORM_OBJECT_FILE _befere_ issuing PURGE notification

pull/72/head
bebopagogo 2022-09-07 11:48:40 -04:00
parent 2e3d00e254
commit b896f5408f
3 changed files with 9 additions and 1 deletions

View File

@ -361,6 +361,7 @@ class NormFileObject : public NormObject
const char* infoPtr = NULL, const char* infoPtr = NULL,
UINT16 infoLen = 0); UINT16 infoLen = 0);
bool Accept(const char* thePath); bool Accept(const char* thePath);
void CloseFile();
void Close(); void Close();
const char* GetPath() {return path;} const char* GetPath() {return path;}

View File

@ -2395,7 +2395,7 @@ bool NormFileObject::Accept(const char* thePath)
} }
} // end NormFileObject::Accept() } // end NormFileObject::Accept()
void NormFileObject::Close() void NormFileObject::CloseFile()
{ {
if (file.IsOpen()) if (file.IsOpen())
{ {
@ -2403,6 +2403,11 @@ void NormFileObject::Close()
file.Unlock(); file.Unlock();
file.Close(); file.Close();
} }
} // end NormFileObject::CloseFile()
void NormFileObject::Close()
{
CloseFile();
NormObject::Close(); NormObject::Close();
} // end NormFileObject::Close() } // end NormFileObject::Close()

View File

@ -2132,6 +2132,8 @@ void NormSession::DeleteTxObject(NormObject *obj, bool notify)
ASSERT(NULL != obj); ASSERT(NULL != obj);
if (tx_table.Remove(obj)) if (tx_table.Remove(obj))
{ {
if (NormObject::FILE == obj->GetType())
static_cast<NormFileObject*>(obj)->CloseFile();
Notify(NormController::TX_OBJECT_PURGED, (NormSenderNode *)NULL, obj); Notify(NormController::TX_OBJECT_PURGED, (NormSenderNode *)NULL, obj);
NormObjectId objectId = obj->GetId(); NormObjectId objectId = obj->GetId();
tx_pending_mask.Unset(objectId); tx_pending_mask.Unset(objectId);