[haiku-commits] haiku: hrev47327 - src/apps/terminal

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 6 Jun 2014 21:30:29 +0200 (CEST)

hrev47327 adds 2 changesets to branch 'master'
old head: d3657dc2bcf3cad9091137d5ed22e0b56e639a66
new head: 5fe7d79d30ec36b0ffb96bd907d8d6da37ed6e64
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=5fe7d79+%5Ed3657dc

----------------------------------------------------------------------------

0bdf336: Revert "Terminal: Fix crash when changing window size."
  
  This reverts commit d3657dc2bcf3cad9091137d5ed22e0b56e639a66.

5fe7d79: Terminal: Fix crash when changing window size
  
  ... try 2 without a spurious \
  
  sorry for the noise.
  
  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

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

1 file changed, 2 insertions(+), 2 deletions(-)
src/apps/terminal/TermView.cpp | 4 ++--

############################################################################

Commit:      0bdf33686ce26659b7be53d10fb087257e879296
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0bdf336
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Fri Jun  6 19:27:20 2014 UTC

Revert "Terminal: Fix crash when changing window size."

This reverts commit d3657dc2bcf3cad9091137d5ed22e0b56e639a66.

----------------------------------------------------------------------------

diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp
index 3aa1754..f06ab5f 100644
--- a/src/apps/terminal/TermView.cpp
+++ b/src/apps/terminal/TermView.cpp
@@ -1215,8 +1215,6 @@ TermView::DetachedFromWindow()
 {
        be_clipboard->StopWatching(BMessenger(this));
 
-       _NextState(fDefaultState);
-
        delete fWinchRunner;
        fWinchRunner = NULL;
 
@@ -3022,7 +3020,7 @@ TermView::_NextState(State* state)
        if (state != fActiveState) {
                if (fActiveState != NULL)
                        fActiveState->Exited();
-\              fActiveState = state;
+               fActiveState = state;
                fActiveState->Entered();
        }
 }

############################################################################

Revision:    hrev47327
Commit:      5fe7d79d30ec36b0ffb96bd907d8d6da37ed6e64
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5fe7d79
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Fri Jun  6 19:28:36 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/10902

Terminal: Fix crash when changing window size

... try 2 without a spurious \

sorry for the noise.

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

----------------------------------------------------------------------------

diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp
index f06ab5f..8267c80 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;
 


Other related posts:

  • » [haiku-commits] haiku: hrev47327 - src/apps/terminal - jscipione