Skip to content

Commit

Permalink
[ci release] Handle more error cases when copy to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed May 25, 2021
1 parent 24012d2 commit b4df740
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/ui/src/abstractlogview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,8 @@ void AbstractLogView::copy()
auto text = selection_.getSelectedText( logData_ );
text.replace( QChar::Null, QChar::Space );
clipboard->setText( text );
} catch ( const std::bad_alloc& ) {
LOG_ERROR << "not enough memory";
} catch ( std::exception& err ) {
LOG_ERROR << "failed to copy data to clipboard " << err.what();
}
}

Expand Down Expand Up @@ -1545,8 +1545,8 @@ void AbstractLogView::updateGlobalSelection()
// Updating it only for "non-trivial" (range or portion) selections
if ( !selection_.isSingleLine() )
clipboard->setText( selection_.getSelectedText( logData_ ), QClipboard::Selection );
} catch ( const std::bad_alloc& ) {
LOG_ERROR << "not enough memory";
} catch ( std::exception& err ) {
LOG_ERROR << "failed to copy data to clipboard " << err.what();
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/ui/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#include <QNetworkReply>
#include <cassert>
#include <exception>
#include <iostream>

#include <cmath>
Expand Down Expand Up @@ -810,8 +811,8 @@ void MainWindow::copy()
// Put it in the global selection as well (X11 only)
clipboard->setText( text, QClipboard::Selection );
}
} catch ( const std::bad_alloc& ) {
LOG_ERROR << "not enough memory";
} catch ( std::exception& err ) {
LOG_ERROR << "failed to copy data to clipboard " << err.what();
}
}

Expand Down

0 comments on commit b4df740

Please sign in to comment.