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
This commit is contained in:
John Scipione
2014-06-06 15:14:15 -04:00
parent 7f1f341e5f
commit d3657dc2bc
+3 -1
View File
@@ -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();
}
}