Hello,
i have a crash on creating my own SynEdit class.
This does not happen the firtst time but on every run at the same
count of Create.
This is the Debugger window:
SYSTEM_TOBJECT_$__NEWINSTANCE$$TOBJECT
0040AF50 83ec08 sub $0x8,%esp
0040AF53 895c2404 mov %ebx,0x4(%esp)
0040AF57 89c3 mov %eax,%ebx
0040AF59 89d8 mov %ebx,%eax
0040AF5B 8b10 mov (%eax),%edx
0040AF5D 89e0 mov %esp,%eax
0040AF5F e88c2c0000 call 0x40dbf0 <SYSTEM_GETMEM$POINTER$LONGWORD>
0040AF64 8b0424 mov (%esp),%eax
0040AF67 85c0 test %eax,%eax
0040AF69 7428 je 0x40af93 <SYSTEM_TOBJECT_$__NEWINSTANCE$$TOBJECT+67>
0040AF6B 8b13 mov (%ebx),%edx
0040AF6D 8b0424 mov (%esp),%eax
0040AF70 b100 mov $0x0,%cl
0040AF72 e8a987ffff call 0x403720 <SYSTEM_FILLCHAR$formal$LONGINT$BYTE>
0040AF77 8b0424 mov (%esp),%eax
And this is the call stack:
#0 SYSTEM_TOBJECT_$__NEWINSTANCE$$TOBJECT at :0
#1 TSYNEDITLINES__CREATE(0x4390e98, 0x57db80 <TCUSTOMSYNEDIT__MARKTEXTASSAVED>, 0x6647a0, <error reading variable>) at syneditlines.pas:302
#2 TCUSTOMSYNEDIT__CREATE(0x4390e98, 0x6647a0, <error reading variable>) at synedit.pp:1922
#3 TSUSEDIT__CREATE(0x0, 0xe29cd68 'C:\X-Lazarus\Projekte\susIDE\Cobol\h054backup\src\SFCF8360.CBL', 0x1cbca8 'C:\X-Lazarus\Projekte\susIDE\Cobol\h054backup\src\SFPB8360.CBL', 0x601404, <error reading variable>) at susedit.pas:138
#4 TEDITORFILE__CREATEFORCOPY(0x1e95acc0 'SFCF8360.CBL', <error reading variable>) at susEditorFile.pas:864
#5 WORTSPEICHERN(0x2aef784) at susEditorFile.pas:726
#6 TEDITORFILE__SCANEDITORFILE(0, 0x1e2250, 0x1b8c78, <error reading variable>) at susEditorFile.pas:804
#7 TEDITORFILE__SCAN(<error reading variable>) at susEditorFile.pas:327
#8 TFORMMAIN__LOADFILE(0x43894d8 'C:\X-Lazarus\Projekte\susIDE\Cobol\h054backup\src\SFPB8360.CBL', <error reading variable>) at susMain.pas:446
#9 TFORMMAIN__MENUITEM_OEFFNENCLICK(0x43b02f0, <error reading variable>) at susMain.pas:222
#10 TMENUITEM__CLICK(<error reading variable>) at .\include\menuitem.inc:84
#11 HANDLEITEM(0x43b02f0, 0x2aef900) at .\include\menu.inc:247
#12 TMENU__ISSHORTCUT({MSG = 48384, CHARCODE = 79, UNUSED = 62768, KEYDATA = 1572865, RESULT = 0}, <error reading variable>) at .\include\menu.inc:266
#13 TCUSTOMFORM__ISSHORTCUT({MSG = 48384, CHARCODE = 79, UNUSED = 62768, KEYDATA = 1572865, RESULT = 0}, <error reading variable>) at .\include\customform.inc:2473
#14 ISSHORTCUT(0x2aef960) at .\include\wincontrol.inc:5645
#15 TWINCONTROL__DOKEYDOWNBEFOREINTERFACE({MSG = 48384, CHARCODE = 79, UNUSED = 62768, KEYDATA = 1572865, RESULT = 0}, false, <error reading variable>) at .\include\wincontrol.inc:5708
#16 TWINCONTROL__CNKEYDOWN({MSG = 48384, CHARCODE = 79, UNUSED = 62768, KEYDATA = 1572865, RESULT = 0}, <error reading variable>) at .\include\wincontrol.inc:7006
#17 SYSTEM_TOBJECT_$__DISPATCH$formal at :0
#18 RAISELOOP(0x2aefc14) at .\include\wincontrol.inc:6916
#19 TWINCONTROL__WNDPROC({MSG = 48384, WPARAM = -181403569, LPARAM = 1572865, RESULT = 0, WPARAMLO = 79, WPARAMHI = 62768, WPARAMFILLER = {}, LPARAMLO = 1, LPARAMHI = 24, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}, <error reading variable>) at .\include\wincontrol.inc:5326
#20 DELIVERMESSAGE(0x1e1340, void) at lclmessageglue.pas:112
#21 WINDOWPROC(461706, 256, 79, 1572865) at .\win32\win32callback.inc:2480
#22 USER32!CallWindowProcA at :0
#23 USER32!CallWindowProcA at :0
#24 USER32!GetOpenClipboardWindow at :0
#25 USER32!DlgDirListComboBoxW at :0
#26 TWIN32WIDGETSET__APPPROCESSMESSAGES(<error reading variable>) at .\win32\win32object.inc:367
#27 TAPPLICATION__HANDLEMESSAGE(<error reading variable>) at .\include\application.inc:1272
#28 TAPPLICATION__RUNLOOP(<error reading variable>) at .\include\application.inc:1405
#29 TWIDGETSET__APPRUN(0x422e50 <TAPPLICATION__RUNLOOP>, <error reading variable>) at .\include\interfacebase.inc:54
#30 TAPPLICATION__RUN(<error reading variable>) at .\include\application.inc:1393
#31 main at susIDE.lpr:19
At the stage of the error only the standard constructors where called:
constructor TsusEdit.Create(AOwner: TComponent; AFileName, AEditorFile: String);
begin
inherited Create(AOwner); <--
constructor TCustomSynEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
SetInline(True);
ControlStyle:=ControlStyle+[csOwnedChildrenNotSelectable];
FScrollBarUpdateLock := 0;
FPaintLock := 0;
FStatusChangeLock := 0;
FUndoBlockAtPaintLock := 0;
FRecalcCharsAndLinesLock := 0;
FStatusChangedList := TSynStatusChangedHandlerList.Create;
FDefaultBeautifier := TSynBeautifier.Create(self);
FBeautifier := FDefaultBeautifier;
FLines := TSynEditStringList.Create;
TSynEditStringList(FLines).AttachSynEdit(Self);
FCaret := TSynEditCaret.Create;
FCaret.MaxLeftChar := @CurrentMaxLineLen;
FCaret.AddChangeHandler(@CaretChanged);
FInternalCaret := TSynEditCaret.Create;
FInternalCaret.MaxLeftChar := @CurrentMaxLineLen;
// Create the lines/views
FTrimmedLinesView := TSynEditStringTrimmingList.Create(fLines, fCaret);
FDoubleWidthChrLinesView := SynEditStringDoubleWidthChars.Create
(FTrimmedLinesView);
{$IFDEF WithSynExperimentalCharWidth}
FSysCharWidthLinesView := TSynEditStringSystemWidthChars.Create(FDoubleWidthChrLinesView, Self.Canvas);
FBidiChrLinesView := TSynEditStringBidiChars.Create(FSysCharWidthLinesView);
FTabbedLinesView := TSynEditStringTabExpander.Create(FBidiChrLinesView);
{$ELSE}
{$IFnDEF WithOutSynBiDi}
FBidiChrLinesView := TSynEditStringBidiChars.Create(FDoubleWidthChrLinesView);
{$ENDIF}
// ftab, currently has LengthOfLongestLine, therefore must be after DoubleWidthChar
{$IFnDEF WithOutSynBiDi }
FTabbedLinesView := TSynEditStringTabExpander.Create(FBidiChrLinesView);
{$ELSE}
FTabbedLinesView := TSynEditStringTabExpander.Create(FDoubleWidthChrLinesView);
{$ENDIF}
{$ENDIF} // WithSynExperimentalCharWidth
// Pointer to the First/Lowest View
// TODO: this should be Folded...
FTheLinesView := FTabbedLinesView;
FTopLinesView := FTrimmedLinesView;
FFoldedLinesView := TSynEditFoldedView.Create(FTheLinesView, fCaret);
FFoldedLinesView.OnFoldChanged := @FoldChanged;
FFoldedLinesView.OnLineInvalidate := @InvalidateGutterLines;
FFoldedLinesView.DisplayView.NextView := FTheLinesView.DisplayView;
FDisplayView := FFoldedLinesView.DisplayView;
// External Accessor
FStrings := TSynEditLines.Create(TSynEditStringList(FLines), @MarkTextAsSaved); <--
constructor TSynEditLines.Create(ATextBuffer: TSynEditStringList; OnSaved: TSavedNotification);
begin
inherited Create; <--
class function TObject.NewInstance : tobject;
var
p : pointer;
begin
getmem(p, InstanceSize); <--
if p <> nil then
InitInstance(p);
NewInstance:=TObject(p);
end;
Any idea?