forked from quickshell/quickshell
io/fileview: use deleteLater() to delete file watchers
Fixes crashes when writing a file while watching it.
This commit is contained in:
parent
91000a582b
commit
0224fa942b
1 changed files with 3 additions and 1 deletions
|
@ -490,7 +490,9 @@ void FileView::updatePath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileView::updateWatchedFiles() {
|
void FileView::updateWatchedFiles() {
|
||||||
delete this->watcher;
|
// 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->targetPath.isEmpty() && this->bWatchChanges) {
|
if (!this->targetPath.isEmpty() && this->bWatchChanges) {
|
||||||
qCDebug(logFileView) << "Creating watcher for" << this << "at" << this->targetPath;
|
qCDebug(logFileView) << "Creating watcher for" << this << "at" << this->targetPath;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue