[Lazarus] Access violation in SYSGETMEM_FIXED - memory corruption?

cobines cobines at gmail.com
Thu May 26 23:21:54 CEST 2011


I have added some debugging text in two functions that set text to a
control: TWinControl.RealSetText and widgetset specific
TWin32WSWinControl.SetText (like in attached diff).

This is a log from execution of a program when it crashes:

TWin32WSWinControl.SetText before 0005FBD8 refcount=2 size=17
TWin32WSWinControl.SetText after  0005FBD8 refcount=2 size=17
TWin32WSWinControl.SetText before 00066D10 refcount=3 size=3
TWin32WSWinControl.SetText after  00066D10 refcount=3 size=3
TWinControl.RealSetText before    00526F18 refcount=-1 size=15
TWin32WSWinControl.SetText before 00526F18 refcount=-1 size=15
TWin32WSWinControl.SetText after  00526F18 refcount=-1 size=15
TWinControl.RealSetText after     00526F18 refcount=-1 size=15
TWinControl.RealSetText before    0007F8A0 refcount=1 size=55
TWin32WSWinControl.SetText before 0007F8A0 refcount=1 size=55
TWin32WSWinControl.SetText after  0007F8A0 refcount=522612 size=0
TWinControl.RealSetText after     0007F8A0 refcount=522612 size=0
TWinControl.RealSetText before    00056A80 refcount=1 size=17
TWin32WSWinControl.SetText before 00056A80 refcount=1 size=17
TWin32WSWinControl.SetText after  00056A80 refcount=355076 size=0
TWinControl.RealSetText after     00056A80 refcount=355076 size=354980

In TWin32WSWinControl.SetText there is corruption of the string record
(but the contents are fine).

Now, if I change
  procedure TControl.SetText(const Value: TCaption);
to
  procedure TControl.SetText(Value: TCaption);

everything is fine:

TWin32WSWinControl.SetText before 0005FBD8 refcount=2 size=17
TWin32WSWinControl.SetText after  0005FBD8 refcount=2 size=17
TWin32WSWinControl.SetText before 00066D10 refcount=3 size=3
TWin32WSWinControl.SetText after  00066D10 refcount=3 size=3
TWinControl.RealSetText before    00526F18 refcount=-1 size=15
TWin32WSWinControl.SetText before 00526F18 refcount=-1 size=15
TWin32WSWinControl.SetText after  00526F18 refcount=-1 size=15
TWinControl.RealSetText after     00526F18 refcount=-1 size=15
TWinControl.RealSetText before    0007F8A0 refcount=2 size=55
TWin32WSWinControl.SetText before 0007F8A0 refcount=2 size=55
TWin32WSWinControl.SetText after  0007F8A0 refcount=1 size=55
TWinControl.RealSetText after     0007F8A0 refcount=1 size=55
TWinControl.RealSetText before    0007F910 refcount=2 size=53
TWin32WSWinControl.SetText before 0007F910 refcount=2 size=53
TWin32WSWinControl.SetText after  0007F910 refcount=1 size=53
TWinControl.RealSetText after     0007F910 refcount=1 size=53

--
cobines
-------------- next part --------------
A non-text attachment was scrubbed...
Name: settext_debug.diff
Type: application/octet-stream
Size: 1781 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110526/f252da44/attachment-0003.obj>


More information about the Lazarus mailing list