[Lazarus] Clipboard.HasFormat(CF_TEXT)

C Western l at c-m-w.me.uk
Mon May 26 13:31:41 CEST 2014


I may have discovered an issue with the clipboard on Linux/GTK2. My 
application updates a paste button and menu item via an action that 
updates on idle by calling Clipboard.HasFormat(CF_TEXT). Pasting is 
intermittently failing/hanging for 10 seconds, and I think the issue is 
that the Clipboard.HasFormat routine is reentered. Clipboard.HasFormat 
can call Application.ProcessMessages, and a possible failure path seems 
to be that a Ctrl+V arrives during this call of ProcessMessages, and in 
handling this Clipboard.HasFormat is called, and the routine seems to 
have nothing to protect against reentry.

Two Ctrl+V's in quick succession could potentially trigger then same 
issue, if the clipboard contents are large.

Have I misunderstood something? I couldn't see anything in the bug 
tracker about this, though there is a reported issue about large pastes.
I can't see any obvious fix at the application level other than leaving 
the paste items permanently enabled.

I think this is not an issue in MS Windows as I don't think the 
clipboard requires communication with another process.

Colin




More information about the Lazarus mailing list