Lazarus crash with GTK+ 2.14.3


<h3><details><summary>Original Reporter info from Mantis: <small>ivo_steinmann@gmx.net</small></summary><small>

- **Reporter name:** Ivo Steinmann
</small></details></h3>

## Description:

Lazarus crash with GTK+ 2.14.3

It's easy to reproduce over Copy&past, but there are also other situations where it hangs.

## Steps to reproduce:

1. Start Lazarus<br/>
2. Select some text<br/>
3. Press CTRL+C (or right mouse button -> copy) to copy the text

Now lazarus hangs or terminates. Take a look at additional informations for a gdb backtracing.

## Additional information:

``` pascal
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7f1e3b1ac740 (LWP 31534)]
0x00007f1e38e9ad55 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007f1e38e9ad55 in raise () from /lib/libc.so.6
#1  0x00007f1e38e9c0ce in abort () from /lib/libc.so.6
#2  0x00007f1e38ed3c07 in ?? () from /lib/libc.so.6
#3  0x00007f1e38ed8e0d in ?? () from /lib/libc.so.6
#4  0x00007f1e38edab06 in free () from /lib/libc.so.6
#5  0x00000000008c8925 in CLEARTARGETLISTS (WIDGET=0x161e460, parentfp=0x7fff432f2810) at ../gtk/gtkwidgetset.inc:5058
#6  0x00000000008c87be in SETCLIPBOARDWIDGET (TARGETWIDGET=0x0, this=0x15d1e48) at ../gtk/gtkwidgetset.inc:5078
#7  0x00000000008ca292 in CLIPBOARDGETOWNERSHIP (CLIPBOARDGETOWNERSHIP=false, CLIPBOARDTYPE=CTCLIPBOARD, ONREQUESTPROC=
      {Proc = {procedure (^pointer, QWord, ^TSTREAM = class )} 0x7fff432f28f8, Self = 0x2131918}, FORMATCOUNT=2, FORMATS=0x17aa608, this=0x15d1e48) at ../gtk/gtkwinapi.inc:689
#8  0x00000000007a29f2 in CLIPBOARDGETOWNERSHIP (CLIPBOARDGETOWNERSHIP=true (255), CLIPBOARDTYPE=CTCLIPBOARD, ONREQUESTPROC=
      {Proc = {procedure (^pointer, QWord, ^TSTREAM = class )} 0x7fff432f2938, Self = 0x2131918}, FORMATCOUNT=2, FORMATS=0x17aa608) at include/lclintf.inc:92
#9  0x000000000087d59a in GETOWNERSHIP (GETOWNERSHIP=false, this=0x2131918) at include/clipbrd.inc:217
#10 0x000000000087d69a in ENDUPDATE (ENDUPDATE=true, this=0x2131918) at include/clipbrd.inc:249
#11 0x000000000087d288 in ADDFORMAT (ADDFORMAT=false, FORMATID=136, BUFFER=@0x162b048, SIZE=12, this=0x2131918) at include/clipbrd.inc:145
#12 0x0000000000a913c8 in DOCOPYTOCLIPBOARD (STEXT=0x17a9db8 'LoadImages', this=0x1e2a7f8) at synedit.pp:1356
#13 0x0000000000a9151f in COPYTOCLIPBOARD (this=0x1e2a7f8) at synedit.pp:1425
#14 0x0000000000aa499a in EXECUTECOMMAND (COMMAND=201, ACHAR='', DATA=0x0, this=0x1e2a7f8) at synedit.pp:8366
#15 0x0000000000aa1ba9 in COMMANDPROCESSOR (COMMAND=201, ACHAR='', DATA=0x0, this=0x1e2a7f8) at synedit.pp:7497
#16 0x0000000000a94158 in KEYDOWN (KEY=@0x7fff432f3488, SHIFT=4, this=0x1e2a7f8) at synedit.pp:2274
#17 0x00000000007eac63 in KEYDOWNBEFOREINTERFACE (KEY=@0x7fff432f3488, SHIFT=4, this=0x1e2a7f8) at include/wincontrol.inc:4981
#18 0x00000000007eaff1 in DOKEYDOWNBEFOREINTERFACE (DOKEYDOWNBEFOREINTERFACE=true, MESSAGE=@0x7fff432f3480, this=0x1e2a7f8) at include/wincontrol.inc:5117
#19 0x00000000007ed225 in CNKEYDOWN (MESSAGE=@0x7fff432f3480, this=0x1e2a7f8) at include/wincontrol.inc:6200
#20 0x0000000000692a00 in DISPATCH (MESSAGE=@0x0, this=0x0) at ../inc/objpas.inc:451
#21 0x00000000007ed208 in ?? ()
#22 0x0000000001e2a7f8 in ?? ()
#23 0x000000000134ac40 in _$SYNEDIT$_Ld74 ()
#24 0x00007f1e0000001b in ?? ()
#25 0x00007f1e0000bd00 in ?? ()
#26 0x00007fff432f3480 in ?? ()
#27 0x0000000001e2a7f8 in ?? ()
#28 0x00007f1e3b2d0000 in ?? ()
#29 0x0000000001629c60 in ?? ()
#30 0x0000000000896680 in GTK2HIDECB (GTK2HIDECB=true (32542), WIDGET=0x7fff432f3480, DATA=0x1e2a7f8) at gtk2widgetset.inc:62
#31 0x00000000007ea1c8 in WNDPROC (MESSAGE=@0x7fff432f3480, this=0x1e2a7f8) at include/wincontrol.inc:4749
#32 0x0000000000aa0656 in WNDPROC (MSG=@0x7fff432f3480, this=0x1e2a7f8) at synedit.pp:7008
#33 0x00000000008e76c5 in DELIVERMESSAGE (DELIVERMESSAGE=6967070, TARGET=0x1e2a7f8, AMESSAGE=@0x7fff432f3480) at ../gtk/gtkproc.inc:3547
#34 0x00000000008e42d6 in HANDLEGTKKEYUPDOWN (HANDLEGTKKEYUPDOWN=false, AWIDGET=0x1a3abc0, AEVENT=0x20ffde0, ADATA=0x1b13268, ABEFOREEVENT=true, AHANDLEDOWN=true) at ../gtk/gtkproc.inc:2264
#35 0x00000000008966aa in GTK2KEYDOWN (GTK2KEYDOWN=false, WIDGET=0x1a3abc0, EVENT=0x20ffde0, DATA=0x1b13268) at gtk2widgetset.inc:68
#36 0x00007f1e3a72067d in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#37 0x00007f1e3a126d79 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#38 0x00007f1e3a1372b1 in ?? () from /usr/lib/libgobject-2.0.so.0
#39 0x00007f1e3a1383b8 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#40 0x00007f1e3a138753 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#41 0x00007f1e3a812cae in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#42 0x00007f1e3a719911 in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0
#43 0x00007f1e3a71a957 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#44 0x00007f1e3a3ac50c in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#45 0x00007f1e39e754f2 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#46 0x00007f1e39e787d5 in ?? () from /usr/lib/libglib-2.0.so.0
#47 0x00007f1e39e78cdb in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#48 0x00007f1e3a71aadd in gtk_main_iteration_do () from /usr/lib/libgtk-x11-2.0.so.0
#49 0x00000000008c11d6 in APPWAITMESSAGE (this=0x15d1e48) at ../gtk/gtkwidgetset.inc:1253
#50 0x00000000006b079f in IDLE (WAIT=true, this=0x15bdc58) at include/application.inc:315
#51 0x00000000006b242a in HANDLEMESSAGE (this=0x15bdc58) at include/application.inc:985
#52 0x00000000006b27e2 in RUNLOOP (this=0x15bdc58) at include/application.inc:1095
#53 0x000000000072e068 in APPRUN (ALOOP={Proc = {procedure (^pointer)} 0x7fff432f3d00, Self = 0x15bdc58}, this=0x15d1e48) at include/interfacebase.inc:49
#54 0x00000000006b2784 in RUN (this=0x15bdc58) at include/application.inc:1082
#55 0x0000000000683b72 in main () at lazarus.pp:107
```

## Mantis conversion info:

- **Mantis ID:** 12407
- **OS:** Linux Gentoo x86_64
- **OS Build:** 2006
- **Build:** r17013
- **Platform:** AMD64 x2 am2
- **Version:** 0.9.27 (SVN)
- **Fixed in version:** 0.9.27 (SVN)
- **Fixed in revision:** 17272 (#2e48fd922ad9cfdfd2eab14f0cc76236300241f5)
- **Monitored by:** » luizamerico (Luiz Americo)
- **Target version:** 1.0.0
- **LazTarget:** 1.0

Story points: 100.0