mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-10-01 22:25:55 +08:00
Fix copy/paste in wxGTK when a clipboard manager is running
Simplify clipboard operations in GTK to not clear clipboard before changing its contents. When changing the clipboard contents the current code emits a lot of noise on the X11 connection, it clears the contents and verifies it's empty before settings the new content. This non-atomic operation is problematic for desktop environments with clipboard managers that try to replace an empty clipboard. It becomes racey as to the order of things being set. Closes #26265. Closes #26278.
This commit is contained in:
committed by
Vadim Zeitlin
parent
5d63efc902
commit
f11053a2d3
+10
-5
@@ -646,8 +646,6 @@ bool wxClipboard::SetData( wxDataObject *data )
|
||||
|
||||
wxCHECK_MSG( data, false, wxT("data is invalid") );
|
||||
|
||||
Clear();
|
||||
|
||||
return AddData( data );
|
||||
}
|
||||
|
||||
@@ -658,9 +656,16 @@ bool wxClipboard::AddData( wxDataObject *data )
|
||||
wxCHECK_MSG( data, false, wxT("data is invalid") );
|
||||
|
||||
// we can only store one wxDataObject so clear the old one
|
||||
Clear();
|
||||
|
||||
Data() = data;
|
||||
if ( m_usePrimary )
|
||||
{
|
||||
delete m_dataPrimary;
|
||||
m_dataPrimary = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_dataClipboard;
|
||||
m_dataClipboard = data;
|
||||
}
|
||||
|
||||
// get formats from wxDataObjects
|
||||
const size_t count = data->GetFormatCount();
|
||||
|
||||
Reference in New Issue
Block a user