io/fileview: null watcher ptr after deletion to avoid UAF

Fixes #69
This commit is contained in:
outfoxxed 2025-06-21 12:57:15 -07:00
parent 8be18c05ed
commit 20c3da01f1
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -492,7 +492,10 @@ void FileView::updatePath() {
void FileView::updateWatchedFiles() {
// If inotify events are sent to the watcher after deletion and deleteLater
// isn't used, a use after free in the QML engine will occur.
if (this->watcher) this->watcher->deleteLater();
if (this->watcher) {
this->watcher->deleteLater();
this->watcher = nullptr;
}
if (!this->targetPath.isEmpty() && this->bWatchChanges) {
qCDebug(logFileView) << "Creating watcher for" << this << "at" << this->targetPath;