OK, have done some more 'research' !
Attached is my demo programme. (Does not depend on KControls).
My Observations
- I can reproduce it on 4 Linux boxes, 64bit and 32bit, Ubuntu and Fedora.
- An empty clipboard does not show the problem. Only one with image data but no text.
- The problem shows up when built with Lazarus 1.8.something. Using fixes_2_0 'fixes' the problem but, I suspect, does so by introducing another problem, it does not report any image data in the clipboard so, seems like an empty clipboard which does not exhibit the problem. Be good if someone else with both 1.8.4 and [trunk, fixes_2_0, rc3] could compare clipboard contents when they have a clipboard of image but not text.
- I create that clipboard with image but not text by right clicking an image in my Firefox browser and choosing 'copy image' - have not managed to do it any other way. Maybe its a Firefox bug ? Even so, memory corruption should not happen ....
- It does not show up on Mac Sierra or Windows 10, just a Linux issue.
Typical of the error messages I see on the console after a sigsegV -
Marked memory at $00007FFFEC013C40 invalid
Wrong signature $AAAAAAAA instead of D348D123
$000000000063B7E1 line 305 of include/clipbrd.inc
$000000000063C141 line 462 of include/clipbrd.inc
$0000000000461904 line 73 of unit1.pas
#73 of unit1 is the line that called clipboard.astext
wp, the problem does not depend on KControls, its just that my project, where I first found it, uses KControls, specifically KMemo. Like you, I trolled through the (1.8.4) clipboard code and could see nothing obviously (and it would have to be obvious for me to spot it) wrong. But as its a clearly a memory issues, its quite nasty, I have not been seen anything in bug tracker to indicate its a known issue thats been fixed. So, perhaps, its still in there ? I have not yet looked at your attachment, will do so now, things moving slowly on New Year's Day......
lucamar - how can you make your clients use Unity ? its dead and gone (thankfully) - I run U18.04 on a 2011 Atom powered netbook, it works OK, rather that than a scary unsupported OS - I hope your luck holds ...