Clipboard Hang
Original Reporter info from Mantis: mftq75
-
Reporter name: C Western
Original Reporter info from Mantis: mftq75
- Reporter name: C Western
Description:
Repeatedly copying a large quantity of text can cause lazarus to hang. (gtk2 specific)
Steps to reproduce:
Select a large block of text in another application (I tried both gedit and libre office calc) then press and hold Ctrl+V in the lazarus edit window. After inserting a few copied of the text, lazarus hangs for several seconds.
There seem to be other ways of triggering the problem - an application enabling/disabling a paste button on idle gave intermittent hangs, but the above is perhaps the easiest way of demonstrating the problem
Additional information:
The issue seems to be that having more than one outstanding clipboard request fails, and multiple requests can easily be triggered as the clipboard routines must call Application.ProcessMessages while waiting for data. I attach a patch that fixes the problem for me, by waiting for the previous request to finish before starting any new ones. (I think this does not slow things down, as gtk_selection_convert only allows one request per widget.)
I attach two versions of the patch - clip1 is the minimal version that fixes the problem, clip2 removes some extra code that I think is redundant.
Mantis conversion info:
- Mantis ID: 26242
- OS: linux
- Platform: x86_64
- Version: 1.2.1 (SVN)
- Fixed in revision: 45271 (#edbff727)