From d3657dc2bcf3cad9091137d5ed22e0b56e639a66 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 6 Jun 2014 15:07:35 -0400 Subject: [PATCH] Terminal: Fix crash when changing window size. From the commits list (Ingo) <<-EOF > Terminal crashes because fView is not connected to App Server when > this is called so calling fView->GetMouse() is not allowed. The interesting questions therefore are: 1) Why is the view not attached? 2) Why is it in the hyper link state? 1) is because the BTabView removes the non-selected tabs instead of just hiding them. The reason for 2) is that the tab was opened with Cmd+T (the bug is not reproducible when the tab is opened via menu item). Pressing Cmd causes hyper link state to be entered and switching to the new tab will leave the view in that state due to 1). Possible solutions: * TermView::_VisibleTextBufferChanged(): Call state hook only when attached to window. All other occurrences are safe as they are in BView hooks. * Leave the hyper link state when the view is detached from the window. A new dummy state could be active as long as the view is not attached, though using DefaultState would be harmless as well. EOF I chose solution 2 using DefaultState rather than creating a new dummy state. Thanks Ingo. Fixes #10902 --- src/apps/terminal/TermView.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index f06ab5f6db..3aa17548d1 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -1215,6 +1215,8 @@ TermView::DetachedFromWindow() { be_clipboard->StopWatching(BMessenger(this)); + _NextState(fDefaultState); + delete fWinchRunner; fWinchRunner = NULL; @@ -3020,7 +3022,7 @@ TermView::_NextState(State* state) if (state != fActiveState) { if (fActiveState != NULL) fActiveState->Exited(); - fActiveState = state; +\ fActiveState = state; fActiveState->Entered(); } }