|
a/src/qtgui/main.cpp |
|
b/src/qtgui/main.cpp |
|
... |
|
... |
48 |
|
48 |
|
49 |
#include "recollq.h"
|
49 |
#include "recollq.h"
|
50 |
|
50 |
|
51 |
extern RclConfig *theconfig;
|
51 |
extern RclConfig *theconfig;
|
52 |
|
52 |
|
53 |
PTMutexInit thetempfileslock;
|
53 |
std::mutex thetempfileslock;
|
54 |
static vector<TempFile> o_tempfiles;
|
54 |
static vector<TempFile> o_tempfiles;
|
55 |
/* Keep an array of temporary files for deletion at exit. It happens that we
|
55 |
/* Keep an array of temporary files for deletion at exit. It happens that we
|
56 |
erase some of them before exiting (ie: when closing a preview tab), we don't
|
56 |
erase some of them before exiting (ie: when closing a preview tab), we don't
|
57 |
reuse the array holes for now */
|
57 |
reuse the array holes for now */
|
58 |
void rememberTempFile(TempFile temp)
|
58 |
void rememberTempFile(TempFile temp)
|
59 |
{
|
59 |
{
|
60 |
PTMutexLocker locker(thetempfileslock);
|
60 |
std::unique_lock<std::mutex> locker(thetempfileslock);
|
61 |
o_tempfiles.push_back(temp);
|
61 |
o_tempfiles.push_back(temp);
|
62 |
}
|
62 |
}
|
63 |
|
63 |
|
64 |
void forgetTempFile(string &fn)
|
64 |
void forgetTempFile(string &fn)
|
65 |
{
|
65 |
{
|
66 |
if (fn.empty())
|
66 |
if (fn.empty())
|
67 |
return;
|
67 |
return;
|
68 |
PTMutexLocker locker(thetempfileslock);
|
68 |
std::unique_lock<std::mutex> locker(thetempfileslock);
|
69 |
for (vector<TempFile>::iterator it = o_tempfiles.begin();
|
69 |
for (vector<TempFile>::iterator it = o_tempfiles.begin();
|
70 |
it != o_tempfiles.end(); it++) {
|
70 |
it != o_tempfiles.end(); it++) {
|
71 |
if ((*it) && !fn.compare((*it)->filename())) {
|
71 |
if ((*it) && !fn.compare((*it)->filename())) {
|
72 |
it->reset();
|
72 |
it->reset();
|
73 |
}
|
73 |
}
|
|
... |
|
... |
75 |
fn.erase();
|
75 |
fn.erase();
|
76 |
}
|
76 |
}
|
77 |
|
77 |
|
78 |
void deleteAllTempFiles()
|
78 |
void deleteAllTempFiles()
|
79 |
{
|
79 |
{
|
80 |
PTMutexLocker locker(thetempfileslock);
|
80 |
std::unique_lock<std::mutex> locker(thetempfileslock);
|
81 |
o_tempfiles.clear();
|
81 |
o_tempfiles.clear();
|
82 |
}
|
82 |
}
|
83 |
|
83 |
|
84 |
Rcl::Db *rcldb;
|
84 |
Rcl::Db *rcldb;
|
85 |
|
85 |
|