protected:
CrashRecoveryContext *context;
CrashRecoveryContextCleanup(CrashRecoveryContext *context)
- : context(context) {}
+ : context(context), cleanupFired(false) {}
public:
bool cleanupFired;
- CrashRecoveryContextCleanup() : cleanupFired(false) {}
virtual ~CrashRecoveryContextCleanup();
virtual void recoverResources() = 0;
}
~CrashRecoveryContextCleanupRegistrar() {
+ unregister();
+ }
+
+ void unregister() {
if (cleanup && !cleanup->cleanupFired)
- cleanup->getContext()->unregisterCleanup(cleanup);
+ cleanup->getContext()->unregisterCleanup(cleanup);
+ cleanup = 0;
}
};
}