From de66c65f3c40762f74550d961b0ae3bdbde3e3ff Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 3 Apr 2020 15:54:09 +0100 Subject: [PATCH] Don't immediately read back clipboard data on OSX This causes an ASAN error because something in the wx clipboard cache is incorrect (so it tries to copy more data than it has available). Closing the clipboard and reopening to read works (since close clears the cache). --- pcbnew/kicad_clipboard.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index aea12b7119..6f7a5d0267 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -199,15 +199,20 @@ void CLIPBOARD_IO::SaveSelection( const PCBNEW_SELECTION& aSelected ) clipboard->Flush(); + #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 - // such as KDE's Klipper + // such as KDE's Klipper. However, a read back of the data on OSX before the + // 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. { wxTextDataObject data; clipboard->GetData( data ); ( void )data.GetText(); // Keep unused variable } + #endif }