qt6-bb10/src/corelib/io
Volker Hilsheimer 6ca2008d6e QFile::moveToTrash: fix error reporting on Windows
If a move-to-trash operation failed, e.g. because the file was opened by
another process (or QFile), then the moveToTrash function would still
return true.

MSDN documents the IFileOperation::PerformOperations to return whether
the operation succeeded, but evidently this is only a statement about
the execution of queued up operations, not a statement about any of the
operations' success.

If the operation succeeded is reported by an HRESULT parameter
of the IFileOperationProgressSink::PostDeleteItem implementation,
and we ignored that parameter so far.

Check it via the SUCCEEDED macro, and set a boolean sink variable based
on that, which we can inspect to return the correct value.

Augment the test case by opening those files we create ourselves, and
if that fails (which it will on Windows, but not necessarily on other
platforms), then try again after closing the file. If the first attempt
succeeded, then the source file must also be gone.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117383
Done-With: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icb82a0c9d3b337585dded622d6656e07dee33d84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-09-24 14:10:56 -07:00
..
forkfd_qt.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qabstractfileengine.cpp Add QFileInfo::readSymLink() to read the raw link path 2022-12-23 06:26:44 +01:00
qabstractfileengine_p.h Add QFileInfo::readSymLink() to read the raw link path 2022-12-23 06:26:44 +01:00
qbuffer.cpp Deprecate Q_ASSUME() 2023-08-14 17:36:37 -07:00
qbuffer.h QBuffer: optimize setData(ptr, n) 2022-08-20 21:22:53 +02:00
qdataurl.cpp qdataurl: extract string literals 2023-09-10 12:02:42 +03:00
qdataurl_p.h Remove redundant QPair includes 2023-09-06 17:24:40 +00:00
qdebug.cpp QDebug: rewrite timeUnit() into putTimeUnit() 2023-07-10 13:51:52 +00:00
qdebug.h QDebug: rewrite timeUnit() into putTimeUnit() 2023-07-10 13:51:52 +00:00
qdebug_p.h Port QtDebugUtils::toPrintable() to qint64/qsizetype 2022-08-21 08:28:44 +02:00
qdir.cpp Replace ushort*/uint* with char16_t*/char32_t* in private API [1] 2023-03-15 20:25:57 +00:00
qdir.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qdir_p.h QDir::entryList: don't fill a QFileInfo cache if we just want names 2023-02-07 13:33:01 +01:00
qdiriterator.cpp Port QDir to qsizetype [2/3]: implementation 2022-08-26 19:50:47 +02:00
qdiriterator.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfile.cpp QEXTRACTTESTDATA: include the errorString() in case of failure 2023-08-05 08:22:20 -07:00
qfile.h Remove all class-level [[nodiscard]] from the code-base 2023-06-28 20:48:45 +00:00
qfile_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfiledevice.cpp Avoid potential data races caused by qt_ntfs_permission_lookup 2023-02-08 12:59:19 +01:00
qfiledevice.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfiledevice_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfileinfo.cpp Doc: Remove see also self-reference in QFileInfo 2023-09-10 20:22:37 +02:00
qfileinfo.h QFileInfo: keep member function overloads in Qt7 too 2023-07-07 16:15:54 +00:00
qfileinfo_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfileselector.cpp Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qfileselector.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfileselector_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemengine.cpp Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qfilesystemengine_mac.mm Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemengine_p.h Add QFileInfo::readSymLink() to read the raw link path 2022-12-23 06:26:44 +01:00
qfilesystemengine_unix.cpp moveToTrash/Unix: use lstat() to confirm $root/.Trash is suitable 2023-09-23 16:16:09 -07:00
qfilesystemengine_win.cpp QFile::moveToTrash: fix error reporting on Windows 2023-09-24 14:10:56 -07:00
qfilesystementry.cpp Fix tst_qfilesystementry in unity build 2023-03-15 18:18:01 +01:00
qfilesystementry_p.h Fix tst_qfilesystementry in unity build 2023-03-15 18:18:01 +01:00
qfilesystemiterator_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemiterator_unix.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemiterator_win.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemmetadata_p.h Adapt corelib to use QTimeZone in place of Qt::TimeSpec 2022-12-09 16:16:48 +01:00
qfilesystemwatcher.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemwatcher.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemwatcher_fsevents.mm Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemwatcher_fsevents_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemwatcher_inotify.cpp Fix some narrowing conversion warnings 2023-04-08 13:24:04 +02:00
qfilesystemwatcher_inotify_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemwatcher_kqueue.cpp Core: include mocs 2023-07-07 18:25:50 +02:00
qfilesystemwatcher_kqueue_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemwatcher_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemwatcher_polling.cpp QPollingFileSystemWatcherEngine: change PollingInterval to chrono::seconds 2023-08-18 15:01:28 +00:00
qfilesystemwatcher_polling_p.h QPollingFileSystemWatcherEngine: change PollingInterval to chrono::seconds 2023-08-18 15:01:28 +00:00
qfilesystemwatcher_win.cpp Core: include mocs 2023-07-07 18:25:50 +02:00
qfilesystemwatcher_win_p.h qHash: Add seed argument for classes inheriting QString 2022-09-28 17:03:17 +02:00
qfsfileengine.cpp QFSFileEngine: fix logic 2023-09-10 15:15:09 +03:00
qfsfileengine_iterator.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfsfileengine_iterator_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfsfileengine_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfsfileengine_unix.cpp QFSFileEngine: fix overflow bug when using lseek64 2023-03-13 23:26:28 +02:00
qfsfileengine_win.cpp Add QFileInfo::readSymLink() to read the raw link path 2022-12-23 06:26:44 +01:00
qiodevice.cpp Fix some narrowing conversion warnings 2023-04-08 13:24:04 +02:00
qiodevice.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qiodevice_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qiodevicebase.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qipaddress.cpp Fix some narrowing conversion warnings 2023-04-08 13:24:04 +02:00
qipaddress_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qlockfile.cpp QLockFile: remove unneeded tryLock_impl middle-man 2023-07-07 18:15:40 +02:00
qlockfile.h QLockFile: remove unneeded tryLock_impl middle-man 2023-07-07 18:15:40 +02:00
qlockfile_p.h QLockFile: {set}StaleLockTime: use chrono first 2023-03-15 20:48:31 +02:00
qlockfile_unix.cpp Fix some narrowing conversion warnings 2023-04-08 13:24:04 +02:00
qlockfile_win.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qloggingcategory.cpp Doc: Fix snippet for Q_DECLARE_EXPORTED_CATEGORY 2023-01-02 18:06:29 +01:00
qloggingcategory.h qC{Debug,Info,Warning,Critical}: move the function call to the macro 2023-07-05 22:24:55 -07:00
qloggingregistry.cpp Misc: Fix qsizetype-related narrowing coversions 2023-03-11 12:39:47 +02:00
qloggingregistry_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qnoncontiguousbytedevice.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qnoncontiguousbytedevice_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qntdll_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qprocess.cpp QProcess/Unix: add a simple way to reset the UID and GID for the child 2023-07-08 15:03:23 -07:00
qprocess.h QProcess/Unix: add a simple way to reset the UID and GID for the child 2023-07-08 15:03:23 -07:00
qprocess_darwin.mm Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qprocess_p.h QProcess/Unix: merge some code from startProcess() and startDetached() 2023-06-21 11:12:42 -07:00
qprocess_unix.cpp QProcess: zero-fill a struct sigaction 2023-09-05 12:28:42 +02:00
qprocess_win.cpp QProcessPrivate: remove the member variable "crashed" 2023-05-13 20:25:27 +00:00
qresource.cpp Remove remnants of Qt for Native Client (NACL) 2023-09-23 13:40:44 +02:00
qresource.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qresource_iterator.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qresource_iterator_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qresource_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsavefile.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsavefile.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsavefile_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsettings.cpp doc: Remove QSettings' paths for embedded linux 2023-09-07 15:05:05 +02:00
qsettings.h Set QSettings::Format enum associated values 2023-09-01 03:34:37 +02:00
qsettings_mac.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsettings_p.h Corelib: s/Q_OS_MAC/Q_OS_DARWIN/wg except for doc and definition 2023-03-20 19:18:52 +01:00
qsettings_wasm.cpp wasm: Mark switch case as unreachable 2023-09-07 14:18:26 +00:00
qsettings_win.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qstandardpaths.cpp Add StateLocation & GenericStateLocation to StandardLocation 2023-09-07 01:17:13 +03:00
qstandardpaths.h Add StateLocation & GenericStateLocation to StandardLocation 2023-09-07 01:17:13 +03:00
qstandardpaths_android.cpp JNI: replace TYPE declarations with CLASS declarations 2023-09-20 00:05:39 +02:00
qstandardpaths_haiku.cpp Add StateLocation & GenericStateLocation to StandardLocation 2023-09-07 01:17:13 +03:00
qstandardpaths_mac.mm Add StateLocation & GenericStateLocation to StandardLocation 2023-09-07 01:17:13 +03:00
qstandardpaths_unix.cpp Add StateLocation & GenericStateLocation to StandardLocation 2023-09-07 01:17:13 +03:00
qstandardpaths_win.cpp Add StateLocation & GenericStateLocation to StandardLocation 2023-09-07 01:17:13 +03:00
qstorageinfo.cpp QStorageInfo: mention bind mounts and btrfs subvolumes in API docs 2023-04-08 13:21:39 +02:00
qstorageinfo.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qstorageinfo_linux.cpp QStorageInfo: split Linux specific code to a separate source file 2023-07-09 01:44:49 +03:00
qstorageinfo_linux_p.h QStorageInfo/Linux: add missing include 2023-09-19 05:46:00 +00:00
qstorageinfo_mac.cpp Use new QBA::assign in QStorageInfoPrivate::retrievePosixInfo 2023-08-01 13:22:39 +02:00
qstorageinfo_p.h QStorageInfo: split Linux specific code to a separate source file 2023-07-09 01:44:49 +03:00
qstorageinfo_stub.cpp Redefinition of root on qstorageinfo_stub.cpp 2023-07-31 19:57:15 +02:00
qstorageinfo_unix.cpp QStorageInfo: split Linux specific code to a separate source file 2023-07-09 01:44:49 +03:00
qstorageinfo_win.cpp QStorageInfo: split Linux specific code to a separate source file 2023-07-09 01:44:49 +03:00
qtemporarydir.cpp Remove redundant QPair includes 2023-09-06 17:24:40 +00:00
qtemporarydir.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtemporaryfile.cpp QTemporaryFile: fix narrowing conversion warnings 2023-04-08 13:23:37 +02:00
qtemporaryfile.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtemporaryfile_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qurl.cpp Doc: Fix documentation issues 2023-06-09 18:24:15 +00:00
qurl.h Remove redundant QPair includes 2023-09-06 17:24:40 +00:00
qurl_p.h QDnsLookup: merge some of the domain label expansion code 2023-06-03 19:28:11 -07:00
qurlidna.cpp Replace {add,sub,mul}_overload with q{Add,Sub,Mul}Overload 2023-06-12 13:11:26 +00:00
qurlquery.cpp QtCore: Fix some macro clashes 2023-01-31 18:42:15 +01:00
qurlquery.h QUrlQuery: add missing move constructor 2023-01-20 03:19:21 +00:00
qurlrecode.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwindowspipereader.cpp Core: include mocs 2023-07-07 18:25:50 +02:00
qwindowspipereader_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwindowspipewriter.cpp Core: include mocs 2023-07-07 18:25:50 +02:00
qwindowspipewriter_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qzip.cpp Move QZipReader/Writer from QtGui to QtCore 2023-04-26 12:01:05 +02:00
qzipreader_p.h Move QZipReader/Writer from QtGui to QtCore 2023-04-26 12:01:05 +02:00
qzipwriter_p.h Move QZipReader/Writer from QtGui to QtCore 2023-04-26 12:01:05 +02:00