[apps] Tidy snapshots when leaving the app following an exception

This commit is contained in:
Émilie Feral
2018-12-03 13:30:41 +01:00
committed by LeaNumworks
parent fb44f8617c
commit 10556b477b
2 changed files with 11 additions and 1 deletions

View File

@@ -252,6 +252,17 @@ void AppsContainer::run() {
} else {
// Exception
if (activeApp() != nullptr) {
/* The app models can reference layouts or expressions that have been
* destroyed from the pool. To avoid using them before packing the app
* (in App::willBecomeInactive for instance), we tidy them early on. */
activeApp()->snapshot()->tidy();
/* When an app encoutered an exception due to a full pool, the next time
* the user enters the app, the same exception could happen again which
* would prevent from reopening the app. To avoid being stuck outside the
* app causing the issue, we reset its snapshot when leaving it due to
* exception. For instance, the calculation app can encounter an
* exception when displaying too many huge layouts, if we don't clean the
* history here, we will be stuck outside the calculation app. */
activeApp()->snapshot()->reset();
}
switchTo(appSnapshotAtIndex(0));

View File

@@ -39,7 +39,6 @@ public:
#if EPSILON_GETOPT
virtual void setOpt(const char * name, char * value) {}
#endif
private:
/* tidy clean all dynamically-allocated data */
virtual void tidy();
};