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).
This commit is contained in:
Ian McInerney 2020-04-03 15:54:09 +01:00
parent dac12a6d99
commit de66c65f3c
1 changed files with 6 additions and 1 deletions

View File

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