TSdfDataset causes segfault if used with lazarus
Original Reporter info from Mantis: luca @olivluca
-
Reporter name: Luca Olivetti
Original Reporter info from Mantis: luca @olivluca
- Reporter name: Luca Olivetti
Description:
The attached project causes a segfault if compiled with fpc 3.2.0. Specifically it segfaults in the 3rd call to DataSet.Post.
On my machine (linux x86_64) the segfault occurs in line 963 of rtl/inc/heap.inc ("if poc^.used = 0 then"), under win32 occurs in the same function however I don't know the exact line (I don't have a version of fpc with debug information).
A simple pascal project that does the same (creates a tsdfdataset and appends records) doesn't cause a segfault, that's why I reported the bug under lazarus but I'm not sure it's lazarus or fpc.
If I compile the project with fpc 3.0.4 there's no segfault (unfortunately I cannot use 3.0.4 due to other bugs). For the time being I'm compiling my project with the old and trusty lazarus 1.6.4/fpc 2.6.4.
Additional information:
The stack trace in case it is useful (I'm using the qt5 widgetset):
#0 SYSGETMEM_FIXED(544) at ../inc/heap.inc:963
#1 SYSGETMEM(544) at ../inc/heap.inc:1082
#2 GETMEM(0x45624a, 527) at ../inc/heap.inc:284
#3 NEWANSISTRING(502) at ../inc/astrings.inc:115
#4 fpc_ansistr_setlength(0x0, 502, 0) at ../inc/astrings.inc:776
#5 STORETOBUF(0x7ffff3c451d0, 0x7ffff7fb7318 'ABC,ABC') at fcl-db/src/sdf/sdfdata.pp:1137
#6 GETRECORD(0x7ffff3c451d0, 0x7fffe9f01360 'ABC', GMCURRENT, false) at fcl-db/src/sdf/sdfdata.pp:571
#7 RESYNC(0x7ffff3c451d0, []) at fcl-db/src/base/dataset.inc:2150
#8 POST(0x7ffff3c451d0) at fcl-db/src/base/dataset.inc:2098
#9 LOADDATA(0x7ffff3c451d0) at unit1.pas:49
#10 FORMSHOW(0x7ffff3c43370, 0x7ffff3c43370) at unit1.pas:62
#11 DOSHOW(0x7ffff3c43370) at include/customform.inc:1019
#12 CMSHOWINGCHANGED(0x7ffff3c43370, {MSG = 45081, UNUSEDMSG = 0, WPARAM = 0, LPARAM = 0, RESULT = 0}) at include/customform.inc:649
#13 DISPATCH(0x7ffff3c43370, ) at ../inc/objpas.inc:684
#14 WNDPROC(0x7ffff3c43370, {MSG = 45081, UNUSEDMSG = 0, WPARAM = 0, LPARAM = 0, RESULT = 0}) at include/control.inc:2241
#15 WNDPROC(0x7ffff3c43370, {MSG = 45081, UNUSEDMSG = 0, WPARAM = 0, LPARAM = 0, RESULT = 0}) at include/wincontrol.inc:5411
#16 WNDPROC(0x7ffff3c43370, {MSG = 45081, UNUSEDMSG = 0, WPARAM = 0, LPARAM = 0, RESULT = 0}) at include/customform.inc:1477
#17 PERFORM(0x7ffff3c43370, 45081, 0, 0) at include/control.inc:1581
#18 CHANGESHOWING(0x7fffffffe1e0, true) at include/wincontrol.inc:4385
#19 UPDATESHOWING(0x7ffff3c43370) at include/wincontrol.inc:4435
#20 UPDATESHOWING(0x7ffff3c43370) at include/customform.inc:2799
#21 DOALLAUTOSIZE(0x7ffff3c43370) at include/wincontrol.inc:3589
#22 ENABLEAUTOSIZING(0x7ffff3c43370) at include/control.inc:5754
#23 SETVISIBLE(0x7ffff3c43370, true) at include/control.inc:4557
#24 SETVISIBLE(0x7ffff3c43370, true) at include/customform.inc:492
#25 SHOW(0x7ffff3c43370) at include/customform.inc:2330
#26 RUN(0x7ffff3c42bb0) at include/application.inc:1404
#27 main at project1.lpr:19