Skip to content

Commit

Permalink
Fix TerminalControl crash on exit
Browse files Browse the repository at this point in the history
ControlCore's _renderer (IRenderTarget) is allocated as std::unique_ptr,
but is given to Terminal::CreateFromSettings as a reference.
ControlCore::Close deallocates the `_renderer`, but if ThrottledFuncs
are still scheduled to call ControlCore::UpdatePatternLocations
it'll cause Terminal::UpdatePatterns to be called, which in turn ends up
accessing the deallocated IRenderTarget reference and lead to a crash.

A proper solution with shared pointers is nontrivial and should be
attempted at a later point in time. This solution moves the teardown of
the _renderer into ControlCore::~ControlCore, where we can be certain
that no further strong references are held by ThrottledFuncs.
  • Loading branch information
lhecker committed May 4, 2021
1 parent 2559ed6 commit 86439da
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 75 deletions.
23 changes: 15 additions & 8 deletions .github/actions/spelling/dictionary/apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ alignof
bitfield
bitfields
BUILDNUMBER
charconv
CLASSNOTAVAILABLE
cmdletbinding
colspan
COLORPROPERTY
colspan
COMDLG
cstdint
CXICON
CYICON
D2DERR_SHADER_COMPILE_FAILED
Expand Down Expand Up @@ -52,6 +54,7 @@ IFile
IInheritable
IMap
IObject
iosfwd
IPackage
IPeasant
IStorage
Expand All @@ -67,7 +70,6 @@ llu
localtime
lround
LSHIFT
MULTIPLEUSE
msappx
MULTIPLEUSE
NCHITTEST
Expand All @@ -91,7 +93,6 @@ PAGESCROLL
PICKFOLDERS
pmr
REGCLS
REGCLS
RETURNCMD
rfind
roundf
Expand All @@ -100,23 +101,22 @@ rx
schandle
semver
serializer
SHELLEXECUTEINFOW
shobjidl
SINGLEUSE
SHOWMINIMIZED
SINGLEUSE
SIZENS
smoothstep
GETDESKWALLPAPER
SHELLEXECUTEINFOW
snprintf
spsc
sregex
STDCPP
strchr
STDMETHOD
strchr
streambuf
Stubless
Subheader
Subpage
UPDATEINIFILE
syscall
TBPF
THEMECHANGED
Expand All @@ -135,12 +135,19 @@ wsregex
wwinmain
XDocument
XElement
xfacet
xhash
xiosbase
xlocale
xlocbuf
xlocinfo
xlocmes
xlocmon
xlocnum
xloctime
xmemory
XParse
xstddef
xstring
xtree
xutility
47 changes: 14 additions & 33 deletions .github/actions/spelling/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ ADDREF
addressof
ADDSTRING
ADDTOOL
aef
AEnd
AFew
AFill
Expand Down Expand Up @@ -98,7 +97,6 @@ ASingle
asm
asmv
asmx
aspnet
aspx
astextplain
AStomps
Expand All @@ -123,7 +121,6 @@ AVerify
AVI
awch
azuredevopspodcast
azurewebsites
azzle
backend
backgrounded
Expand Down Expand Up @@ -174,7 +171,6 @@ BODGY
BOLDFONT
BOOLIFY
bools
boostorg
Bopomofo
Borland
BOTTOMLEFT
Expand All @@ -187,7 +183,6 @@ branchconfig
BRK
Browsable
bsearch
BSODs
bstr
BTNFACE
buf
Expand All @@ -202,7 +197,7 @@ BValue
byref
bytearray
bytebuffer
Cac
cac
callee
cang
capslock
Expand Down Expand Up @@ -302,7 +297,7 @@ codepage
codepath
codepoint
codeproject
COINIT
coinit
COLLECTIONURI
colorizing
colororacle
Expand Down Expand Up @@ -487,7 +482,6 @@ CYSIZEFRAME
CYSMICON
CYVIRTUALSCREEN
CYVSCROLL
dahall
dai
DATABLOCK
DATAVIEW
Expand Down Expand Up @@ -575,7 +569,6 @@ defaultsettings
DEFAULTTONEAREST
DEFAULTTONULL
DEFAULTTOPRIMARY
DEFCON
defectdefs
DEFERERASE
deff
Expand Down Expand Up @@ -603,7 +596,6 @@ desktopwindowxamlsource
dest
DESTINATIONNAME
devblogs
developercommunity
devicecode
devicefamily
devops
Expand Down Expand Up @@ -671,13 +663,13 @@ DUNIT
dup'ed
dvi
dw
dwl
DWLP
dwm
dwmapi
dword
dwrite
dwriteglyphrundescriptionclustermap
dwl
dxgi
dxgidwm
dxinterop
Expand Down Expand Up @@ -770,10 +762,8 @@ fclose
fcntl
fdc
FDD
fde
fdopen
fdw
fea
fesb
FFDE
FFrom
Expand Down Expand Up @@ -808,7 +798,6 @@ flyout
fmodern
fmtarg
fmtid
fmtlib
FOLDERID
FONTCHANGE
fontdlg
Expand Down Expand Up @@ -1013,10 +1002,9 @@ horiz
HORZ
hostable
hostlib
hotkeys
HPA
HPAINTBUFFER
HPCON
hpcon
hpj
hpp
HPR
Expand Down Expand Up @@ -1172,7 +1160,6 @@ IRenderer
IScheme
ISelection
IShell
isocpp
issuecomment
IState
IStoryboard
Expand Down Expand Up @@ -1290,7 +1277,7 @@ listptr
listptrsize
lk
lld
llvm
LLVM
llx
LMENU
LMNOP
Expand Down Expand Up @@ -1435,7 +1422,6 @@ mingw
minimizeall
minkernel
MINMAXINFO
mintty
minwin
minwindef
Mip
Expand Down Expand Up @@ -1482,7 +1468,7 @@ MSIL
msix
msrc
msvcrt
msvcrtd
MSVCRTD
MSVS
msys
msysgit
Expand All @@ -1508,7 +1494,7 @@ namestream
nano
natvis
nbsp
Nc
nc
NCCALCSIZE
NCCREATE
NCLBUTTONDOWN
Expand Down Expand Up @@ -1631,7 +1617,6 @@ numlock
numpad
NUMSCROLL
nupkg
NVDA
NVIDIA
NVR
Nx
Expand Down Expand Up @@ -1662,11 +1647,11 @@ ONECOREWINDOWS
onehalf
ONLCR
Oo
openconsoleproxy
openbash
opencode
opencon
openconsole
openconsoleproxy
OPENIF
OPENLINK
openps
Expand Down Expand Up @@ -1784,7 +1769,6 @@ pid
pidl
PIDLIST
pii
pinam
pinvoke
pipename
pipestr
Expand Down Expand Up @@ -1928,7 +1912,6 @@ pythonw
qi
QJ
qo
QOL
QRSTU
qsort
queryable
Expand Down Expand Up @@ -1999,7 +1982,7 @@ REGSTR
reingest
Relayout
RELBINPATH
remoting
Remoting
renamer
renderengine
rendersize
Expand Down Expand Up @@ -2077,8 +2060,8 @@ runut
runxamlformat
rvalue
RVERTICAL
rxvt
RWIN
rxvt
safearray
SAFECAST
safemath
Expand Down Expand Up @@ -2522,22 +2505,21 @@ unicode
UNICODESTRING
UNICODETEXT
UNICRT
UNINIT
uninit
uninitialize
uninstall
Uniscribe
unittest
unittesting
universaltest
Unk
unk
unknwn
unmark
UNORM
unparseable
unpause
Unregister
Unregistering
unte
untests
untextured
untimes
Expand Down Expand Up @@ -2594,7 +2576,6 @@ Vcount
vcpkg
vcprintf
vcproj
vcrt
vcvarsall
vcxitems
vcxproj
Expand Down Expand Up @@ -2830,7 +2811,6 @@ wx
wxh
xa
xact
xamarin
xaml
Xamlmeta
xargs
Expand Down Expand Up @@ -2872,8 +2852,9 @@ XSubstantial
xtended
xterm
XTest
XTPUSHSGR
XTPOPSGR
XTPUSHSGR
xtr
xunit
xutr
xvalue
Expand Down
1 change: 0 additions & 1 deletion .github/actions/spelling/expect/web.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ winui
appshellintegration
cppreference
gfycat
what3words
Guake
Loading

0 comments on commit 86439da

Please sign in to comment.