Suspend use of qt_ntfs_permission_lookup. QTBUG-101168

This commit is contained in:
Roman Telezhynskyi 2022-03-17 13:35:49 +02:00
parent 0644122345
commit 191cf7e25f
9 changed files with 65 additions and 64 deletions

View File

@ -4,6 +4,7 @@
- Fix issue with tile font size. - Fix issue with tile font size.
- [smart-pattern/valentina#171] System identifies two of the same curve. - [smart-pattern/valentina#171] System identifies two of the same curve.
- [smart-pattern/valentina#170] Incorrect work with curves. - [smart-pattern/valentina#170] Incorrect work with curves.
- Suspend use of qt_ntfs_permission_lookup. QTBUG-101168
# Valentina 0.7.50 February 14, 2022 # Valentina 0.7.50 February 14, 2022
- Fix regression. Minimal seam allowance width is less than the point accuracy values. - Fix regression. Minimal seam allowance width is less than the point accuracy values.

View File

@ -1864,15 +1864,15 @@ auto VPMainWindow::IsLayoutReadOnly() const -> bool
return false; return false;
} }
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
bool fileWritable = f.isWritable(); bool fileWritable = f.isWritable();
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
return not fileWritable; return not fileWritable;
} }

View File

@ -3383,13 +3383,13 @@ void TMainWindow::UpdateWindowTitle()
bool isFileWritable = true; bool isFileWritable = true;
if (not curFile.isEmpty()) if (not curFile.isEmpty())
{ {
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
isFileWritable = QFileInfo(curFile).isWritable(); isFileWritable = QFileInfo(curFile).isWritable();
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
showName = StrippedName(curFile); showName = StrippedName(curFile);
} }
else else

View File

@ -6809,13 +6809,13 @@ void MainWindow::UpdateWindowTitle()
bool isFileWritable = true; bool isFileWritable = true;
if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty()) if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{ {
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
isFileWritable = QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).isWritable(); isFileWritable = QFileInfo(VAbstractValApplication::VApp()->GetPatternPath()).isWritable();
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
} }
if (not patternReadOnly && isFileWritable) if (not patternReadOnly && isFileWritable)

View File

@ -31,7 +31,7 @@
#include <QtGlobal> #include <QtGlobal>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; // extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
# include <qt_windows.h> # include <qt_windows.h>
#endif /*Q_OS_WIN*/ #endif /*Q_OS_WIN*/

View File

@ -162,13 +162,13 @@ void VAbstractConverter::ReserveFile() const
.arg(info.absoluteDir().absolutePath(), info.baseName(), GetFormatVersionStr(), info.completeSuffix()); .arg(info.absoluteDir().absolutePath(), info.baseName(), GetFormatVersionStr(), info.completeSuffix());
if (not SafeCopy(m_convertedFileName, reserveFileName, error)) if (not SafeCopy(m_convertedFileName, reserveFileName, error))
{ {
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
const bool isFileWritable = info.isWritable(); const bool isFileWritable = info.isWritable();
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
if (not IsReadOnly() && isFileWritable) if (not IsReadOnly() && isFileWritable)
{ {
const QString errorMsg(tr("Error creating a reserv copy: %1.").arg(error)); const QString errorMsg(tr("Error creating a reserv copy: %1.").arg(error));

View File

@ -986,9 +986,9 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
{ {
bool result = false; bool result = false;
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
QTemporaryFile destFile(destination + QLatin1String(".XXXXXX")); QTemporaryFile destFile(destination + QLatin1String(".XXXXXX"));
destFile.setAutoRemove(false);// Will be renamed to be destination file destFile.setAutoRemove(false);// Will be renamed to be destination file
@ -1042,9 +1042,9 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
} }
} }
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn off check permission again // qt_ntfs_permission_lookup--; // turn off check permission again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
return result; return result;
} }

View File

@ -387,13 +387,13 @@ bool WatermarkWindow::on_actionSave_triggered()
return false; return false;
} }
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
const bool isFileWritable = QFileInfo(m_curFile).isWritable(); const bool isFileWritable = QFileInfo(m_curFile).isWritable();
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
if (not isFileWritable) if (not isFileWritable)
{ {
QMessageBox messageBox(this); QMessageBox messageBox(this);
@ -405,14 +405,14 @@ bool WatermarkWindow::on_actionSave_triggered()
if (messageBox.exec() == QMessageBox::Yes) if (messageBox.exec() == QMessageBox::Yes)
{ {
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
bool changed = QFile::setPermissions(m_curFile, bool changed = QFile::setPermissions(m_curFile,
QFileInfo(m_curFile).permissions() | QFileDevice::WriteUser); QFileInfo(m_curFile).permissions() | QFileDevice::WriteUser);
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
if (not changed) if (not changed)
{ {
@ -523,13 +523,13 @@ void WatermarkWindow::UpdateWindowTitle()
bool isFileWritable = true; bool isFileWritable = true;
if (not m_curFile.isEmpty()) if (not m_curFile.isEmpty())
{ {
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
isFileWritable = QFileInfo(m_curFile).isWritable(); isFileWritable = QFileInfo(m_curFile).isWritable();
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
} }
if (isFileWritable) if (isFileWritable)

View File

@ -42,9 +42,9 @@
#include <QLockFile> #include <QLockFile>
#include <QMessageBox> #include <QMessageBox>
#ifdef Q_OS_WIN //#ifdef Q_OS_WIN
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; //extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
#endif /*Q_OS_WIN*/ //#endif /*Q_OS_WIN*/
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
#include <QStyleFactory> #include <QStyleFactory>
@ -259,9 +259,9 @@ auto VAbstractMainWindow::CheckFilePermissions(const QString &path, QWidget *mes
{ {
QFileInfo info(path); QFileInfo info(path);
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
if (not info.exists()) if (not info.exists())
{ {
@ -271,9 +271,9 @@ auto VAbstractMainWindow::CheckFilePermissions(const QString &path, QWidget *mes
// cppcheck-suppress unreadVariable // cppcheck-suppress unreadVariable
const bool isFileWritable = info.isWritable(); const bool isFileWritable = info.isWritable();
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
if (not isFileWritable) if (not isFileWritable)
{ {
@ -286,13 +286,13 @@ auto VAbstractMainWindow::CheckFilePermissions(const QString &path, QWidget *mes
if (messageBox.exec() == QMessageBox::Yes) if (messageBox.exec() == QMessageBox::Yes)
{ {
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup++; // turn checking on // qt_ntfs_permission_lookup++; // turn checking on
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
bool changed = QFile::setPermissions(path, QFileInfo(path).permissions() | QFileDevice::WriteUser); bool changed = QFile::setPermissions(path, QFileInfo(path).permissions() | QFileDevice::WriteUser);
#ifdef Q_OS_WIN32 //#ifdef Q_OS_WIN32
qt_ntfs_permission_lookup--; // turn it off again // qt_ntfs_permission_lookup--; // turn it off again
#endif /*Q_OS_WIN32*/ //#endif /*Q_OS_WIN32*/
if (not changed) if (not changed)
{ {