Enhancement - Hooks
- Implemented pre-completed, post-completed events. - Added debug info for event triggers. - Removed support for pre-file-unlock, post-file-unlock, as they are called from TDB::~TDB in Context::~Context, which is after Hooks::~Hooks, which means segfault.
This commit is contained in:
36
src/TDB.cpp
36
src/TDB.cpp
@@ -144,30 +144,26 @@ void TDB::lock (bool lockFile /* = true */)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TDB::unlock ()
|
||||
{
|
||||
if (mAllOpenAndLocked && context.hooks.trigger ("pre-file-unlock"))
|
||||
mPending.clear ();
|
||||
mNew.clear ();
|
||||
mModified.clear ();
|
||||
|
||||
foreach (location, mLocations)
|
||||
{
|
||||
mPending.clear ();
|
||||
mNew.clear ();
|
||||
mModified.clear ();
|
||||
fflush (location->pending);
|
||||
fclose (location->pending);
|
||||
location->pending = NULL;
|
||||
|
||||
foreach (location, mLocations)
|
||||
{
|
||||
fflush (location->pending);
|
||||
fclose (location->pending);
|
||||
location->pending = NULL;
|
||||
fflush (location->completed);
|
||||
fclose (location->completed);
|
||||
location->completed = NULL;
|
||||
|
||||
fflush (location->completed);
|
||||
fclose (location->completed);
|
||||
location->completed = NULL;
|
||||
|
||||
fflush (location->undo);
|
||||
fclose (location->undo);
|
||||
location->completed = NULL;
|
||||
}
|
||||
|
||||
mAllOpenAndLocked = false;
|
||||
context.hooks.trigger ("post-file-unlock");
|
||||
fflush (location->undo);
|
||||
fclose (location->undo);
|
||||
location->completed = NULL;
|
||||
}
|
||||
|
||||
mAllOpenAndLocked = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user