exit more abruptly to avoid mysterious core dump on quitting program

This commit is contained in:
Jean-Francois Dockes 2016-05-11 08:44:11 +02:00
parent 7c00fcc50b
commit 1d4a75ccca
3 changed files with 16 additions and 5 deletions

View File

@ -75,6 +75,11 @@ void forgetTempFile(string &fn)
fn.erase();
}
void deleteAllTempFiles()
{
PTMutexLocker locker(thetempfileslock);
o_tempfiles.clear();
}
Rcl::Db *rcldb;
@ -152,9 +157,8 @@ static void recollCleanup()
deleteZ(rcldb);
deleteZ(theconfig);
PTMutexLocker locker(thetempfileslock);
o_tempfiles.clear();
deleteAllTempFiles();
#ifdef RCL_USE_ASPELL
deleteZ(aspell);
#endif

View File

@ -18,6 +18,7 @@
#include <utility>
#include MEMORY_INCLUDE
#include <stdlib.h>
#include <qapplication.h>
#include <qmessagebox.h>
@ -687,8 +688,13 @@ void RclMain::fileExit()
rwSettings(true);
// Let the exit handler clean up the rest (internal recoll stuff).
exit(0);
// We should do the right thing and let exit() call all the
// cleanup handlers. But we have few persistent resources and qt
// exit is a great source of crashes and pita. So do our own
// cleanup:
deleteAllTempFiles();
// and scram out
_Exit(0);
}
// Start a db query and set the reslist docsource

View File

@ -39,6 +39,7 @@ extern RclConfig *theconfig;
extern void rememberTempFile(TempFile);
extern void forgetTempFile(string &fn);
extern void deleteAllTempFiles();
extern Rcl::Db *rcldb;
extern int recollNeedsExit;