Skip to content

Comments

Fix drag-and-drop file open corrupting backupFilename#9

Merged
borislav-angelov merged 1 commit intomasterfrom
fix-drag-n-drop-mac
Feb 24, 2026
Merged

Fix drag-and-drop file open corrupting backupFilename#9
borislav-angelov merged 1 commit intomasterfrom
fix-drag-n-drop-mac

Conversation

@developeritsme
Copy link
Contributor

On macOS, dragging a file onto the window could trigger both the DropOverlay drop handler and a QEvent::FileOpen via AppDelegate, potentially with different file paths. Because openBackupFile() set backupFilename before validating the file, a stale or unreadable path from the FileOpen event could silently overwrite backupFilename while the UI continued to display the correct filename from the drop.

Move backupFilename assignment after the isReadable() check so invalid paths never corrupt state. Remove the duplicate QEvent::FileOpen handler from MainWindow::event() since AppDelegate already handles it.

On macOS, dragging a file onto the window could trigger both the
DropOverlay drop handler and a QEvent::FileOpen via AppDelegate,
potentially with different file paths. Because openBackupFile() set
backupFilename before validating the file, a stale or unreadable
path from the FileOpen event could silently overwrite backupFilename
while the UI continued to display the correct filename from the drop.

Move backupFilename assignment after the isReadable() check so invalid
paths never corrupt state. Remove the duplicate QEvent::FileOpen
handler from MainWindow::event() since AppDelegate already handles it.
@borislav-angelov borislav-angelov merged commit 5788dd5 into master Feb 24, 2026
@borislav-angelov borislav-angelov deleted the fix-drag-n-drop-mac branch February 24, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants