On 26/05/14 14:38, Mattias Gaertner wrote:
On Mon, 26 May 2014 12:31:41 +0100
C Western <l...@c-m-w.me.uk> wrote:
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.
Can you create a small example?
I would think that any application that uses the clipboard would be
vulnerable to this. For example, I think I can trigger the issue with
two Ctrl-V's in succession with the edittest example in lazarus. Start
it and say libre office (I used a spreadsheet with about 1000 lines of
data.) Select and copy a large block in the spreadsheet, and then hold
down the Ctrl+v key in edittest. A few copies will appear very quickly,
but then the application hangs for several seconds (at least). Lazarus
itself can be made to hang in the same way.
Colin
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus