Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Crash in IWForm.FillRealTabOrder - every 2-3 clicks
#1
Bug 
Hello IntraWeb Team,
i got a nasty problem. My Server crashes every 2-3 clicks.
Every Time on the same Line. For understanding. I build many Items (IWButton/IWLink/...) dynamically and release them if needed.
So i can click around 1-3 times max without crash but after then it happens. I can not find out which problem he has with the list (FillRealTabOrders).
My components will generated at this way: Build the the New one. Give them the Settings from the old Control. Delete the old Control.
For this Tab i use:
  iMemTab := oOldCtrl.TabOrder;
  oOldCtrl.TabOrder := -1;
  oNewCtrl.TabOrder := iMemTab;


System:
Win10 64bit
Delphi 10.2.3
IntraWeb 15.2.3
StandAlone (HTTP.SYS)

[Image: IWCrash.png]

Please help me - i think it is possible that in old intraweb version this problem not exists. But not sure.
with friendly regards
Victoria

-------------------EDIT
In he meanwhile i found out that OnClick seems to cause the trouble. So i switched everything to AsyncClick + (in old version from IntraWeb i could only generate a button before the FormCreate to replace that properly with my own IWButton Class) - now reworked this logic and dont replace the components. This seems to work but causes another Problem.
I has a TIWGrid what i fill with generic items (IWLabel, IWImageFile) and the TIWImageFile worked until my last changes. Exact this trouble i has got describe in the older Ticket here:
https://www.atozed.com/forums/thread-1445.html

But now - not only the first "row" (IWImageFile in the Control of a Row) doesn't work ... none of them does?!  Sad
Maybe you can help me with the new problem.
Reply
#2
Are you able to create a simple test case that recreates this issue?

From your report it is not possible to recreate the application.
Reply
#3
(07-02-2020, 06:23 AM)Alexandre Machado Wrote: Are you able to create a simple test case that recreates this issue?

From your report it is not possible to recreate the application.

I has tried to build a test project but without success. Confused 
But i has found a workaround - in my desperation because I absolutely have to release - I rolled IntraWeb back to version 15.1.8 - and everything worked!
Except for the bug from https://www.atozed.com/forums/thread-1445.html ... but that's better than no function or permanent crashes.
When i got time i tried to build a test programm...

with friendly regards
Victoria
Reply
#4
Can you show me the code that you use to create the components? To free them?

This is too vague to understand what is happening
Reply
#5
Please enable the exception logger in your application and we can have more information about it:

http://docs.atozed.com/docs.dll/developm...ogger.html
Reply
#6
(07-02-2020, 07:11 AM)Alexandre Machado Wrote: Please enable the exception logger in your application and we can have more information about it:

http://docs.atozed.com/docs.dll/developm...ogger.html

Hello, here the last logs again, i has shrinked all what i can to isolate the error.
But it stucks at: IWCompExtCtrls.TIWCustomImage.get_HasTabOrder

http://www.vsoft.de/aw/AW_TrackAndTrace@2020-07-02 15-27-08.6471.Log
http://www.vsoft.de/aw/AW_TrackAndTrace@2020-07-02 15-28-39.0821.Log

This code snippet is the part which generate per IWGrid.Cell a TIWImageFile (so it looks better)
Without this all works fine. With Parent=IntraWebServer hangs completly up ..
But i think it has todo with the TabOrder - the Error logs and the CPU Stacktrace are looking all in the same direction (for me)...
Code:
  procedure SetCellLinkIcon(oCell:TIwGridCell;sImg:String;sHint:String;oEvent:TIWAsyncEvent;sParams:String);
  var
    oLink:TIWImageFile;
  begin
    oLink := TIWImageFile.Create(IWGrid_Dispo);
    //oLink.Parent := TWinControl(IWGrid_Dispo);
    if(sParams<>'')then
    begin
      oLink.Css := 'ImageLink';
    end else
    begin
      oLink.Css := 'ImageLinkForbidden';
    end;
    oLink.Cacheable := true;
    oLink.AutoSize := false;
    oLink.ImageFile.URL := '/'+sImg;
    //oLink.Height := iIconDim;
    //oLink.Width := iIconDim;
    oLink.Hint := sHint;
    oLink.ExtraTagParams.Text := sParams;
    oLink.ShowHint := (sHint<>'');
    oLink.OnAsyncClick := oEvent;
    oLink.TabOrder := -1;
    oCell.Control := oLink;
  end;

for clear (because another search in the DB can bring other results in the grid i use:
Code:
    for i := IWGrid_Dispo.ComponentCount-1 downto 0 do
    begin
      IWGrid_Dispo.Components[i].Free;
    end;
and my logs says: okay every component gets usually the free.

Hope this will help you for improve/finding the bug.
Reply
#7
Hello again,
i would tell that the new Version - IntraWeb 15.2.4 - has the same error included - here from the WebPage after Crash:
[Image: IntraWeb%2015.2.4%20Stack.png]
hopefully this will helps you to find a clue Sad
Reply
#8
I'll have a look and let you know
Reply
#9
Hi Victoria,

Yes, I can recreate it using that code.

I'll dig in and see what I can find. I'll keep you informed.

Cheers
Reply
#10
Hi Victoria,

After playing with your code, here's what happens:

You are creating a TIWImageFile and not setting a parent control which causes it to be included in the internal form's list of controls. But once it has no parent, when it is destroyed it won't notify the form that it is being removed (because the owner is a IWGrid, not the form itself), so the form ends up with a dangling reference to a freed object.

In order to fix it, please set the parent of all your controls created at runtime. Example:

Code:
procedure SetCellLinkIcon(oCell:TIwGridCell;sImg:String;sHint:String;oEvent:TIWAsyncEvent;sParams:String);
  var
    oLink:TIWImageFile;
  begin
    oLink := TIWImageFile.Create(IWGrid_Dispo);
    oLink.Parent := IWGrid_Dispo.Parent;  // <- Add your IWForm directly here, or use the IWGrid's parent
    if(sParams<>'')then
    begin
      oLink.Css := 'ImageLink';
    end else
    begin
      oLink.Css := 'ImageLinkForbidden';
    end;
    oLink.Cacheable := true;
    oLink.AutoSize := false;
    oLink.ImageFile.URL := '/'+sImg;
    //oLink.Height := iIconDim;
    //oLink.Width := iIconDim;
    oLink.Hint := sHint;
    oLink.ExtraTagParams.Text := sParams;
    oLink.ShowHint := (sHint<>'');
    oLink.OnAsyncClick := oEvent;
    oLink.TabOrder := -1;
    oCell.Control := oLink;
  end;

This will fix it.

The way tab order is set in IW 15.2 branch is different compared to 15.1 and this broke your code.

I'm implementing some other checks in a new update so it will also behave as expected even if you don't set the parent of the control. It should be released soon, if you prefer to wait.

Cheers,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)