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:
Paul Beckingham
2010-01-23 13:12:49 -05:00
parent 03f7e0686f
commit b02374c3f5
3 changed files with 42 additions and 34 deletions

View File

@@ -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;
}
////////////////////////////////////////////////////////////////////////////////