File tree Expand file tree Collapse file tree 4 files changed +9
-19
lines changed Expand file tree Collapse file tree 4 files changed +9
-19
lines changed Original file line number Diff line number Diff line change 107107 <release version =" 0.4.3" urgency =" medium" type =" development" >
108108 <description >
109109 <ul >
110- <li > ... </li >
110+ <li >Fixes dead lock bug on mouse selection. </li >
111111 </ul >
112112 </description >
113113 </release >
Original file line number Diff line number Diff line change @@ -954,17 +954,18 @@ bool TerminalSession::operator()(actions::ClearHistoryAndReset)
954954
955955bool TerminalSession::operator ()(actions::CopyPreviousMarkRange)
956956{
957- copyToClipboard (terminal ().extractLastMarkRange ());
957+ crispy::locked (_terminal, [&]() { copyToClipboard (terminal ().extractLastMarkRange ()); } );
958958 return true ;
959959}
960960
961961bool TerminalSession::operator ()(actions::CopySelection copySelection)
962962{
963+
963964 switch (copySelection.format )
964965 {
965966 case actions::CopyFormat::Text:
966967 // Copy the selection in pure text, plus whitespaces and newline.
967- copyToClipboard (terminal ().extractSelectionText ());
968+ crispy::locked (_terminal, [&]() { copyToClipboard (terminal ().extractSelectionText ()); } );
968969 break ;
969970 case actions::CopyFormat::HTML:
970971 // TODO: This requires walking through each selected cell and construct HTML+CSS for it.
@@ -1098,7 +1099,9 @@ bool TerminalSession::operator()(actions::OpenFileManager)
10981099
10991100bool TerminalSession::operator ()(actions::OpenSelection)
11001101{
1101- QDesktopServices::openUrl (QUrl (QString::fromUtf8 (terminal ().extractSelectionText ().c_str ())));
1102+ crispy::locked (_terminal, [&]() {
1103+ QDesktopServices::openUrl (QUrl (QString::fromUtf8 (terminal ().extractSelectionText ().c_str ())));
1104+ });
11021105 return true ;
11031106}
11041107
Original file line number Diff line number Diff line change @@ -1253,8 +1253,6 @@ namespace
12531253
12541254string Terminal::extractSelectionText () const
12551255{
1256- auto const _ = std::scoped_lock { *this };
1257-
12581256 if (!_selection || _selection->state () == Selection::State::Waiting)
12591257 return " " ;
12601258
@@ -1274,8 +1272,6 @@ string Terminal::extractSelectionText() const
12741272
12751273string Terminal::extractLastMarkRange () const
12761274{
1277- auto const _ = std::lock_guard { *this };
1278-
12791275 // -1 because we always want to start extracting one line above the cursor by default.
12801276 auto const bottomLine =
12811277 _currentScreen->cursor ().position .line + LineOffset (-1 ) + _settings.copyLastMarkRangeOffset ;
Original file line number Diff line number Diff line change @@ -391,17 +391,9 @@ class Terminal
391391 void updateInputMethodPreeditString (std::string preeditString);
392392 // }}}
393393
394- void lock () const
395- {
396- _outerLock.lock ();
397- _innerLock.lock ();
398- }
394+ void lock () const { _outerLock.lock (); }
399395
400- void unlock () const
401- {
402- _outerLock.unlock ();
403- _innerLock.unlock ();
404- }
396+ void unlock () const { _outerLock.unlock (); }
405397
406398 [[nodiscard]] ColorPalette const & colorPalette () const noexcept { return _state.colorPalette ; }
407399 [[nodiscard]] ColorPalette& colorPalette () noexcept { return _state.colorPalette ; }
@@ -810,7 +802,6 @@ class Terminal
810802
811803 // synchronization
812804 std::mutex mutable _outerLock;
813- std::mutex mutable _innerLock;
814805
815806 // terminal clock
816807 std::chrono::steady_clock::time_point _currentTime;
You can’t perform that action at this time.
0 commit comments