Exceptions in sThirdParty.GetCommonData

Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #69104
    Greatis
    Participant

    Hello,

    Sometimes this exception fired.
    But I cannot reproduce it.
    But I see in clients error log that the error repeats.

    Can you suggest a fix or workaround?

    Assembler Information:
    ——————————————————————————
    ; sThirdParty.GetCommonData (Line=457 – Offset=8)
    ; ———————————————–
    00561F84 mov edx, [ebp-$04]
    00561F87 mov edx, [edx+$0094]
    00561F8D call sSkinManager.TsSkinManager.IsValidSkinIndex
    00561F92 test al, al
    00561F94 jz sThirdParty.GetCommonData (Line=463)
    00561F96 mov eax, [ebp-$04]
    00561F99 call sCommonData.TsCommonData.GetCommonSkinData
    00561F9E mov eax, [eax+$0520]
    00561FA4 mov edx, [ebp-$04]
    00561FA7 imul edx, [edx+$0094], $22
    00561FAE cmp dword ptr [eax+edx*8+$14], +$64 ; <– EXCEPTION
    00561FB3 jnz sThirdParty.GetCommonData (Line=463)
    ;
    ; Line=461 – Offset=12
    ; ——————–
    00561FB5 push $00
    00561FB7 mov eax, [ebp-$04]
    00561FBA call sCommonData.TsCommonData.GetSkinManager
    00561FBF mov ecx, eax
    00561FC1 mov eax, [ebp+$08]
    00561FC4 mov eax, [eax-$4C]
    00561FC7 mov edx, [ebp-$04]
    00561FCA mov edx, [edx+$0094]
    00561FD0 call sCommonData.GetFontIndex

    Registers:
    —————————–
    EAX: 00000528 EDI: 0000000D
    EBX: 062D3310 ESI: 00000000
    ECX: 00E175E8 ESP: 0019D78C
    EDX: 00000000 EIP: 0060C880

    Another variant:
    ; sThirdParty.GetCommonData (Line=468 – Offset=19)
    ; ————————————————
    0056201A mov edx, [ebp+$08]
    0056201D mov edx, [edx-$44]
    00562020 call sSkinManager.TsSkinManager.IsValidSkinIndex
    00562025 test al, al
    00562027 jz sThirdParty.GetCommonData (Line=471)
    ;
    ; Line=469 – Offset=20
    ; ——————–
    00562029 mov eax, [ebp-$04]
    0056202C call sCommonData.TsCommonData.GetCommonSkinData
    00562031 mov eax, [eax+$0520]
    00562037 mov edx, [ebp+$08]
    0056203A imul edx, [edx-$44], $22
    0056203E mov eax, [eax+edx*8+$1C] ; <– EXCEPTION
    00562042 mov edx, [ebp+$08]
    00562045 mov [edx-$14], eax
    00562048 jmp sThirdParty.GetCommonData (Line=473)
    ;
    ; Line=471 – Offset=22
    ; ——————–
    0056204A mov eax, [ebp+$08]
    0056204D mov dword ptr [eax-$14], $00FFFFFF ; ”…

    Registers:
    —————————–
    EAX: 00000000 EDI: 0019EB88
    EBX: 0019EDEC ESI: 0019EB4C
    ECX: 026AF0D8 ESP: 0019EB24
    EDX: 000007F8 EIP: 0056203E

    AlphaControls 14.22
    Registered User

    #69108
    Support
    Keymaster

    Hello
    Can you try latest version of the package?
    There is a big chance that this error is fixed already.

    #69113
    Greatis
    Participant

    Hi,

    I understand, but I can’t do it, because is hard in reproducing.
    I see it several times on my PC and I see it every day in the user’s bug reports.
    I checked the latest version 15.12.
    The code was not changed: sThirdParty.pas
    Now the line is 460.
    if (DrawData.CurrentState = 0) and
    (SkinData.FOwnerControl.Parent <> nil) and
    (SkinData.SkinManager <> nil) and SkinData.SkinManager.IsValidSkinIndex(SkinData.SkinIndex) and
    (SkinData.CommonSkinData.gd[SkinData.SkinIndex].Props[0].Transparency = 100) then

    The exception is on the:
    SkinData.CommonSkinData.gd[SkinData.SkinIndex].Props[0].Transparency

    I suppose that this code is not safe.
    SkinData received as parameter:
    procedure GetCommonData(SkinData: TsCtrlSkinData);

    SkinIndex maybe wrong or gd is not properly initialized.

    I want to fix the bug and asked your opinion.
    What is SkinData.SkinIndex?
    How to check that it is valid?
    How to check that it is not bigger than the size of “gd”?

    I can add “try/catch” on, but I don’t know how safe is assigning this on exception:
    DrawData.SkinIndex := SkinData.SkinIndex;

    Thank you!
    Dmitry

    #69121
    Support
    Keymaster

    Hello!

    SkinIndex is an index of skin data for appropriate section.
    This index used for searching of data which stored in the sections array (“gd”).

    How to check that it is valid?
    How to check that it is not bigger than the size of “gd”?

    The “IsValidSkinIndex” function checks it already, so, SkinIndex is correct there and “gd” array is not empty.

    Do you know which control has this problem? And when it happens?

    #69129
    Greatis
    Participant

    I have my own grid component.
    I use SkinManager in the main form.
    My grid is declared in Thridparty list as “Grid”.

    The grid component stored in a separate form.
    SkinProvider exists in each form.

    I see the exception immediately after showing the child form.
    The form is created manually.

    #69137
    Support
    Keymaster

    Are you sure that problem is in grid?
    I see this code in the first report: “sThirdParty.GetCommonData”
    This code used for drawing of buttons only. Maybe some button causes the problem there?
    I still think that you should try the latest version of the package. Code in the sThirdParty.pas is not changed, but huge changes in other linked units exists.

    #69141
    Greatis
    Participant

    Thank you for your answer!
    I thought that it was my component.
    But recently I saw the exception and the buttons (sButBtn) were not displayed.

    I suppose you are right, the problem is in drawing buttons.

    I added try/catch to avoid exception:
    DrawData.SkinIndex := SkinData.SkinIndex;
    try
    if (DrawData.CurrentState = 0) and
    (SkinData.FOwnerControl.Parent <> nil) and
    (SkinData.SkinManager <> nil) and SkinData.SkinManager.IsValidSkinIndex(SkinData.SkinIndex) and
    (SkinData.CommonSkinData.gd[SkinData.SkinIndex].Props[0].Transparency = 100) then
    DrawData.SkinIndex := GetFontIndex(Button, SkinData.SkinIndex, SkinData.SkinManager);
    except
    end;

    It works, but there are a lot of codes with direct access to gd.
    SkinData.CommonSkinData.gd[…].

    I guess that IsValidSkinIndex works well, but gd is not properly filled at the moment when we access it.
    Getting this causes the exception:
    Props[0].Transparency

    Is there a workaround?
    How to be sure that the structures are filled well before opening a window with buttons?

    #69145
    Support
    Keymaster

    This structure is filled when skin is loaded immediately.
    If skin is active then this structure is filled. Maybe you know a way how can I repeat the error?
    Which buttons has this error? TsBitBtn? The error occurs when form is shown immediately? Skin is active already there?

    • This reply was modified 4 years, 4 months ago by Support.
    #69351
    Greatis
    Participant

    Hi,

    Seems like the problems were fixed after 2 weeks of monitoring after releasing the new version.
    The problem was in this code:
    SkinManager->Active=RestoreCurSkin();
    I supposed if the property was set it will not executes something.
    I found that it is just true.
    The function SetActive checks for current setting.
    procedure TsSkinManager.SetActive(const Value: boolean);
    begin
    if FActive <> Value then begin
    FActive := Value;

    But at the end of function it executes always:
    SkinListController.SendSkinChanged;

    Usually, it may not a problem, but my program executes this code in Timer a lot of times.

    Hope it will help someone.

    Thanks for help.
    Resolved.

    #69376
    Support
    Keymaster

    Hi
    I will check if code in the SetActive may be improved.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.