Recent

Author Topic: ATSynEdit: Cannot stream chosen component  (Read 589 times)

Alextp

  • Hero Member
  • *****
  • Posts: 1121
    • UVviewsoft
ATSynEdit: Cannot stream chosen component
« on: February 21, 2020, 07:33:10 pm »
https://github.com/Alexey-T/ATSynEdit/issues/246
I see the same error on Linux x64 gtk2, but I don't know where it's raised. Any hints?

Alextp

  • Hero Member
  • *****
  • Posts: 1121
    • UVviewsoft
Re: ATSynEdit: Cannot stream chosen component
« Reply #1 on: February 23, 2020, 12:25:20 pm »
IDE crash stack trace
Quote
#0 CLASSES$_$TWRITER_$__$$_WRITEPROPERTY$TPERSISTENT$POINTER at :0
#1 CLASSES$_$TWRITER_$__$$_WRITEPROPERTIES$TPERSISTENT at :0
#2 ?? at :0
#3 ?? at :0
#4 ?? at :0
#5 ?? at :0
#6 ?? at :0
#7 ?? at :0
#8 ?? at :0
#9 ?? at :0
#10 ?? at :0
#11 ?? at :0
#12 ?? at :0
#13 ?? at :0
#14 ?? at :0
#15 ?? at :0
#16 CLASSES$_$TWRITER_$__$$_WRITEPROPERTIES$TPERSISTENT at :0
#17 ?? at :0

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3828
  • I like bugs.
Re: ATSynEdit: Cannot stream chosen component
« Reply #2 on: February 24, 2020, 03:22:04 pm »
Here is a better debugger backtrace. Tested with FPC trunk from few weeks ago, compiled with debug info.
Code: [Select]
#0 WRITEPROPERTY(0x7fffdae88060, 0x7fffd59ed390, 0x234ddfd) at ../objpas/classes/writer.inc:895
#1 WRITEPROPERTIES(0x7fffdae88060, 0x7fffd59ed390) at ../objpas/classes/writer.inc:850
#2 WRITECOMPONENTDATA(0x7fffdae88060, 0x7fffd59ed390) at ../objpas/classes/writer.inc:764
#3 WRITESTATE(0x7fffd59ed390, 0x7fffdae88060) at ../objpas/classes/compon.inc:454
#4 WRITECOMPONENT(0x7fffdae88060, 0x7fffd59ed390) at ../objpas/classes/writer.inc:688
#5 COPYSELECTIONTOSTREAM(0x7fffee02d9b0, 0x7fffda3b94c0) at ../designer/designer.pp:1159
#6 ADDUNDOACTION(0x7fffee02d9b0, 0x7fffd59ed390, UOPADD, true, 0x1b695b0 'Name', {VTYPE = 256, RES1 = 0, RES2 = 0, RES3 = 0, VSMALLINT = 0, VINTEGER = 0, VSINGLE = 0, VDOUBLE = 0, VDATE = 0, VCURRENCY = 0, VOLESTR = 0x0, VDISPATCH = 0x0, VERROR = 0, VBOOLEAN = false, VUNKNOWN = 0x0, VSHORTINT = 0, VBYTE = 0, VWORD = 0, VLONGWORD = 0, VINT64 = 0, VQWORD = 0, VWORD64 = 0, VSTRING = 0x0, VANY = 0x0, VARRAY = 0x0, VPOINTER = 0x0, VRECORD = 0x0, PRECINFO = 0x0, VLONGS = {0, 0, 0}, VWORDS = {0, 0, 0, 0, 0, 0, 0}, VBYTES = {0 <repeats 14 times>}}, {VTYPE = 256, RES1 = 0, RES2 = 0, RES3 = 0, VSMALLINT = -27368, VINTEGER = -715877096, VSINGLE = -1.46085511e+13, VDOUBLE = 6.9533204388070265e-310, VDATE = 6.9533204388070265e-310, VCURRENCY = 140736772478232, VOLESTR = 0x7fffd5549518 #21569#31059#17774#26980#12660#61184#44478#61406#44478#222, VDISPATCH = 0x7fffd5549518, VERROR = -715877096, VBOOLEAN = 38168, VUNKNOWN = 0x7fffd5549518, VSHORTINT = 24, VBYTE = 24, VWORD = 38168, VLONGWORD = 3579090200, VINT64 = 140736772478232, VQWORD = 140736772478232, VWORD64 = 140736772478232, VSTRING = 0x7fffd5549518, VANY = 0x7fffd5549518, VARRAY = 0x7fffd5549518, VPOINTER = 0x7fffd5549518, VRECORD = 0x7fffd5549518, PRECINFO = 0x0, VLONGS = {0, -715877096, 32767}, VWORDS = {0, 0, 0, 38168, 54612, 32767, 0}, VBYTES = {0, 0, 0, 0, 0, 0, 24, 149, 84, 213, 255, 127, 0, 0}}) at ../designer/designer.pp:1857
#7 ADDCOMPONENT(0x7fffee02d9b0, 0x7fffdb2eac00, 0x234a638, 0x7fffee01d6f0, 39, 194, 0, 0) at ../designer/designer.pp:778
#8 DOADDCOMPONENT(0x7fffffffcf30) at ../designer/designer.pp:2412
#9 MOUSEUPONCONTROL(0x7fffee02d9b0, 0x7fffee01d6f0, {MSG = 514, KEYS = 0, XPOS = 39, YPOS = 194, POS = {X = 39, Y = 194}, DUMMY = 6148914689817575463, RESULT = 0}) at ../designer/designer.pp:2608
#10 ISDESIGNMSG(0x7fffee02d9b0, 0x7fffee01d6f0, {MSG = 514, UNUSEDMSG = 1431655765, WPARAM = 0, LPARAM = 6148914689817575463, RESULT = 0}) at ../designer/designer.pp:3099
#11 WNDPROC(0x7fffee01d6f0, {MSG = 514, UNUSEDMSG = 1431655765, WPARAM = 0, LPARAM = 6148914689817575463, RESULT = 0}) at include/control.inc:2184
#12 WNDPROC(0x7fffee01d6f0, {MSG = 514, UNUSEDMSG = 1431655765, WPARAM = 0, LPARAM = 6148914689817575463, RESULT = 0}) at include/wincontrol.inc:5429
#13 WNDPROC(0x7fffee01d6f0, {MSG = 514, UNUSEDMSG = 1431655765, WPARAM = 0, LPARAM = 6148914689817575463, RESULT = 0}) at include/customform.inc:1437
#14 DELIVERMESSAGE(0x7fffee01d6f0, ) at lclmessageglue.pas:112
#15 DELIVERMESSAGE(0x7fffee01d6f0, ) at gtk2/gtk2proc.inc:3737
#16 DELIVERMOUSEUPMESSAGE(0x2ace680, 0x2f13d70, 0x7fffee01d6f0) at gtk2/gtk2callback.inc:2205
#17 GTKMOUSEBTNRELEASE(0x2f7e4e0, 0x2f13d70, 0x7fffee01d6f0) at gtk2/gtk2callback.inc:2282

This is the code from rtl/objpas/classes/writer.inc with notes added :
Code: Pascal  [Select][+][-]
  1. procedure TWriter.WriteProperty(Instance: TPersistent; PropInfo: Pointer);
  2. var ...
  3. begin
  4.   // do not stream properties without getter
  5.   if not Assigned(PPropInfo(PropInfo)^.GetProc) then
  6.     exit;
  7.   // properties without setter are only allowed, if they are subcomponents
  8.   PropType := PPropInfo(PropInfo)^.PropType;    <-- PropType: Kind=tkClass, Name=TPopupMenu
  9.   if not Assigned(PPropInfo(PropInfo)^.SetProc) then begin
  10.     if PropType^.Kind<>tkClass then
  11.       exit;
  12.     ObjValue := TObject(GetObjectProp(Instance, PropInfo));   <-- ObjValue = Nil !
  13.     if not ObjValue.InheritsFrom(TComponent) or
  14.        not (csSubComponent in TComponent(ObjValue).ComponentStyle) then
  15.       exit;
  16.   end;
  17.   ...
  18.  

GetObjectProp(Instance, PropInfo) returns Nil, it is assigned to ObjValue. The next line ObjValue.InheritsFrom() obviously crashes.
Note, PropType Name=TPopupMenu which should be OK. I see TPopupMenus in the published section.
Did you change something about PopupMenus recently?

This could be a hiccup in FPC trunk but I understood it happens with other FPC versions, too.
Thus your code changes must have triggered it somehow. It may still be a bug in FPC TWriter code. It should not crash in any situation.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux.

Alextp

  • Hero Member
  • *****
  • Posts: 1121
    • UVviewsoft
Re: ATSynEdit: Cannot stream chosen component
« Reply #3 on: February 24, 2020, 05:08:47 pm »
Changed something with PopupMenus? AFAIR, Popup* published property existed already, but I made runtime initing/filling of some other PopupMenus (which show on rt-click over gutter, ruler).

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3828
  • I like bugs.
Re: ATSynEdit: Cannot stream chosen component
« Reply #4 on: February 24, 2020, 07:27:03 pm »
Changed something with PopupMenus? AFAIR, Popup* published property existed already, but I made runtime initing/filling of some other PopupMenus (which show on rt-click over gutter, ruler).
If it used to work but now crashes regardless of FPC version, it must be caused by some change in your code. You must test and bisect your commit history.
If it happened only with FPC trunk then FPC would be the main suspect.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux.

Alextp

  • Hero Member
  • *****
  • Posts: 1121
    • UVviewsoft
Re: ATSynEdit: Cannot stream chosen component
« Reply #5 on: February 24, 2020, 08:28:48 pm »
Now I have PopopText property =nil by default so IDE cannot save this component with nil popupmenu. Moved this prop to "public", it's solved.

 

TinyPortal © 2005-2018