Page MenuHome

Fix T69495: Crash changing file operation in file browser

Authored by Julian Eisel (Severin) on Thu, Sep 5, 11:04 PM.



Calling wm_window_close() within handler code always seemed a bit
dangerous to me. In this case it causes use-after-free. Tried to simply
avoid accessing the dangling pointers but that's quite tricky and fragile.
For normal file window closing it basically works 'by luck'.

So idea is to delay window closing like we do it for workspace deletion,
screen change, etc. Unfortunately that implies that the file browser
windows still exists on save. This patch implements two ways to address
this (toggled with USE_WIN_REM_LIST_HACK):

  • Skip windows scheduled for closing on file write. One ugly thing about this is that pointers to these windows may still be stored as they are still in the window list. Screen data of the windows is also still around and saved, we'd have to explicitly skip that too.
  • [USE_WIN_REM_LIST_HACK defined] Schedules the window for closing and removes it from the window list. We may have to restore it temporarily if the window manager is free'd on file read.

Diff Detail

rB Blender
temp-T69495 (branched from master)
Build Status
Buildable 4793
Build 4793: arc lint + arc unit

Event Timeline

Grr... Found a much better solution, which I tried earlier, but made a little mistake. Glad I checked again...