diff --git a/3d-viewer/3d_viewer/eda_3d_viewer.cpp b/3d-viewer/3d_viewer/eda_3d_viewer.cpp index 1a47e11126..d592104c41 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer.cpp @@ -866,6 +866,8 @@ void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event ) { wxBitmap bitmap( screenshotImage ); + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap ); diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index 764c9e6341..2d72a7aa4d 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -683,6 +683,8 @@ void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event ) std::string buffer; ExportToBuffer( buffer, format ); + wxLogNull doNotLog; // disable logging of failed clipboard actions + // Write buffer to the clipboard if (wxTheClipboard->Open()) { diff --git a/common/dialog_about/dialog_about.cpp b/common/dialog_about/dialog_about.cpp index a9d6080400..359985d4e5 100644 --- a/common/dialog_about/dialog_about.cpp +++ b/common/dialog_about/dialog_about.cpp @@ -471,6 +471,8 @@ void DIALOG_ABOUT::onHtmlLinkClicked( wxHtmlLinkEvent& event ) void DIALOG_ABOUT::onCopyVersionInfo( wxCommandEvent& event ) { + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( !wxTheClipboard->Open() ) { wxMessageBox( _( "Could not open clipboard to write version information." ), diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp index f3c39db71a..1bdb56c284 100644 --- a/common/dialogs/wx_html_report_panel.cpp +++ b/common/dialogs/wx_html_report_panel.cpp @@ -230,6 +230,8 @@ void WX_HTML_REPORT_PANEL::onMenuEvent( wxMenuEvent& event ) { if( event.GetId() == wxID_COPY ) { + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { bool primarySelection = wxTheClipboard->IsUsingPrimarySelection(); diff --git a/common/grid_tricks.cpp b/common/grid_tricks.cpp index b7667a4de8..0252375a4c 100644 --- a/common/grid_tricks.cpp +++ b/common/grid_tricks.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -253,6 +254,8 @@ void GRID_TRICKS::showPopupMenu( wxMenu& menu ) menu.Enable( GRIDTRICKS_ID_PASTE, false ); + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { if( wxTheClipboard->IsSupported( wxDF_TEXT ) ) @@ -470,6 +473,8 @@ void GRID_TRICKS::onKeyDown( wxKeyEvent& ev ) void GRID_TRICKS::paste_clipboard() { + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { if( wxTheClipboard->IsSupported( wxDF_TEXT ) ) @@ -585,6 +590,8 @@ void GRID_TRICKS::paste_text( const wxString& cb_text ) void GRID_TRICKS::cutcopy( bool doCut ) { + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { wxGridTableBase* tbl = m_grid->GetTable(); diff --git a/common/scintilla_tricks.cpp b/common/scintilla_tricks.cpp index 1699e95332..ba6851cb64 100644 --- a/common/scintilla_tricks.cpp +++ b/common/scintilla_tricks.cpp @@ -162,6 +162,8 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent ) if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() ) m_te->DeleteBack(); + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { if( wxTheClipboard->IsSupported( wxDF_TEXT ) ) diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index c363e791a9..8591d25837 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -975,6 +975,8 @@ void TOOL_MANAGER::ScheduleContextMenu( TOOL_BASE* aTool, ACTION_MENU* aMenu, bool TOOL_MANAGER::SaveClipboard( const std::string& aTextUTF8 ) { + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { // Store the UTF8 string as unicode string in clipboard: @@ -993,6 +995,8 @@ std::string TOOL_MANAGER::GetClipboardUTF8() const { std::string result; + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { if( wxTheClipboard->IsSupported( wxDF_TEXT ) diff --git a/cvpcb/tools/cvpcb_association_tool.cpp b/cvpcb/tools/cvpcb_association_tool.cpp index 28226a7e7c..7a88e0489f 100644 --- a/cvpcb/tools/cvpcb_association_tool.cpp +++ b/cvpcb/tools/cvpcb_association_tool.cpp @@ -84,6 +84,8 @@ int CVPCB_ASSOCIATION_TOOL::CopyAssoc( const TOOL_EVENT& aEvent ) if( !fpid.IsValid() ) return 0; + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ); @@ -118,20 +120,24 @@ int CVPCB_ASSOCIATION_TOOL::CutAssoc( const TOOL_EVENT& aEvent ) return 0; // Save it to the clipboard - if( wxTheClipboard->Open() ) { - if( !wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ) ) + wxLogNull doNotLog; // disable logging of failed clipboard actions + + if( wxTheClipboard->Open() ) { + if( !wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ) ) + { + wxTheClipboard->Close(); + return 0; + } + + wxTheClipboard->Flush(); wxTheClipboard->Close(); + } + else + { return 0; } - - wxTheClipboard->Flush(); - wxTheClipboard->Close(); - } - else - { - return 0; } // Remove the association @@ -153,14 +159,18 @@ int CVPCB_ASSOCIATION_TOOL::PasteAssoc( const TOOL_EVENT& aEvent ) LIB_ID fpid; wxTextDataObject data; - if( wxTheClipboard->Open() ) { - wxTheClipboard->GetData( data ); - wxTheClipboard->Close(); - } - else - { - return 0; + wxLogNull doNotLog; // disable logging of failed clipboard actions + + if( wxTheClipboard->Open() ) + { + wxTheClipboard->GetData( data ); + wxTheClipboard->Close(); + } + else + { + return 0; + } } if( fpid.Parse( data.GetText() ) >= 0 ) diff --git a/eeschema/dialogs/dialog_choose_symbol.cpp b/eeschema/dialogs/dialog_choose_symbol.cpp index 35bdff2340..3738daabf4 100644 --- a/eeschema/dialogs/dialog_choose_symbol.cpp +++ b/eeschema/dialogs/dialog_choose_symbol.cpp @@ -325,6 +325,7 @@ void DIALOG_CHOOSE_SYMBOL::OnCharHook( wxKeyEvent& e ) !e.AltDown() && !e.ShiftDown() && !e.MetaDown() ) { wxString txt = m_details->SelectionToText(); + wxLogNull doNotLog; // disable logging of failed clipboard actions if( wxTheClipboard->Open() ) { diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index d7971b2ab1..257e892aa4 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -528,12 +528,16 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard() PrintPage( GetRenderSettings() ); - if( wxTheClipboard->Open() ) { - // This data objects are held by the clipboard, so do not delete them in the app. - wxBitmapDataObject* clipbrd_data = new wxBitmapDataObject( image ); - wxTheClipboard->SetData( clipbrd_data ); - wxTheClipboard->Close(); + wxLogNull doNotLog; // disable logging of failed clipboard actions + + if( wxTheClipboard->Open() ) + { + // This data objects are held by the clipboard, so do not delete them in the app. + wxBitmapDataObject* clipbrd_data = new wxBitmapDataObject( image ); + wxTheClipboard->SetData( clipbrd_data ); + wxTheClipboard->Close(); + } } // Deselect Bitmap from DC in order to delete the MemoryDC diff --git a/eeschema/symbol_editor/symbol_editor.cpp b/eeschema/symbol_editor/symbol_editor.cpp index e7b8ea50ab..1901284079 100644 --- a/eeschema/symbol_editor/symbol_editor.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -761,6 +761,8 @@ void SYMBOL_EDIT_FRAME::CopyPartToClipboard() STRING_FORMATTER formatter; SCH_SEXPR_PLUGIN::FormatPart( tmp.get(), formatter ); + wxLogNull doNotLog; // disable logging of failed clipboard actions + auto clipboard = wxTheClipboard; wxClipboardLocker clipboardLock( clipboard ); @@ -788,6 +790,8 @@ void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard ) if( aFromClipboard ) { + wxLogNull doNotLog; // disable logging of failed clipboard actions + auto clipboard = wxTheClipboard; wxClipboardLocker clipboardLock( clipboard ); diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index d748ebe0f2..b16f0521b6 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -281,6 +281,8 @@ void PANEL_SETUP_BOARD_STACKUP::onExportToClipboard( wxCommandEvent& event ) // Build a ascii representation of stackup and copy it in the clipboard wxString report = BuildStackupReport( m_stackup, m_units ); + wxLogNull doNotLog; // disable logging of failed clipboard actions + if( wxTheClipboard->Open() ) { // This data objects are held by the clipboard, diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 69729abc2b..f7ba0f99a4 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -240,6 +240,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri } // These are placed at the end to minimize the open time of the clipboard + wxLogNull doNotLog; // disable logging of failed clipboard actions auto clipboard = wxTheClipboard; wxClipboardLocker clipboardLock( clipboard ); @@ -251,7 +252,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri clipboard->Flush(); - #ifndef __WXOSX__ +#ifndef __WXOSX__ ) // This section exists to return the clipboard data, ensuring it has fully // been processed by the system clipboard. This appears to be needed for // extremely large clipboard copies on asynchronous linux clipboard managers @@ -259,12 +260,13 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri // clipboard is closed seems to cause an ASAN error (heap-buffer-overflow) // since it uses the cached version of the clipboard data and not the system // clipboard data. + if( clipboard->IsSupported( wxDF_TEXT ) ) { wxTextDataObject data; clipboard->GetData( data ); - ( void )data.GetText(); // Keep unused variable + (void) data.GetText(); // Keep unused variable } - #endif +#endif } @@ -273,13 +275,14 @@ BOARD_ITEM* CLIPBOARD_IO::Parse() BOARD_ITEM* item; wxString result; + wxLogNull doNotLog; // disable logging of failed clipboard actions + auto clipboard = wxTheClipboard; wxClipboardLocker clipboardLock( clipboard ); if( !clipboardLock ) return nullptr; - if( clipboard->IsSupported( wxDF_TEXT ) ) { wxTextDataObject data; @@ -320,6 +323,8 @@ void CLIPBOARD_IO::Save( const wxString& aFileName, BOARD* aBoard, m_out->Print( 0, ")\n" ); + wxLogNull doNotLog; // disable logging of failed clipboard actions + auto clipboard = wxTheClipboard; wxClipboardLocker clipboardLock( clipboard ); @@ -334,6 +339,7 @@ void CLIPBOARD_IO::Save( const wxString& aFileName, BOARD* aBoard, // been processed by the system clipboard. This appears to be needed for // extremely large clipboard copies on asynchronous linux clipboard managers // such as KDE's Klipper + if( clipboard->IsSupported( wxDF_TEXT ) ) { wxTextDataObject data; clipboard->GetData( data ); @@ -347,6 +353,8 @@ BOARD* CLIPBOARD_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, { std::string result; + wxLogNull doNotLog; // disable logging of failed clipboard actions + auto clipboard = wxTheClipboard; wxClipboardLocker clipboardLock( clipboard );