Browse Source

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).
pull/16/head
Ian McInerney 6 years ago
parent
commit
de66c65f3c
  1. 7
      pcbnew/kicad_clipboard.cpp

7
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
}

Loading…
Cancel
Save