Gui: boost 1.76 provides an overloaded version of file_lock that accepts a wchar_t string

This commit is contained in:
wmayer
2021-12-19 21:24:17 +01:00
parent 43f4fffa61
commit 060f3bf8f3
2 changed files with 13 additions and 7 deletions

View File

@@ -658,7 +658,12 @@ void DocumentRecoveryHandler::checkForPreviousCrashes(const std::function<void(Q
QString pid = QString::number(QCoreApplication::applicationPid());
if (bn.startsWith(exeName) && bn.indexOf(pid) < 0) {
QString fn = it->absoluteFilePath();
boost::interprocess::file_lock flock((const char*)fn.toLocal8Bit());
#if !defined(FC_OS_WIN32) || (BOOST_VERSION < 107600)
boost::interprocess::file_lock flock(fn.toUtf8());
#else
boost::interprocess::file_lock flock(fn.toStdWString().c_str());
#endif
if (flock.try_lock()) {
// OK, this file is a leftover from a previous crash
QString crashed_pid = bn.mid(exeName.length()+1);