AV in VCL.TMSFNCCloudBase.Win

I'm converting the TMSFNCCloudStorageServices Demo to provide a cloud backup service in my Desktop app. When selecting a folder (in Google Drive) and clicking the 'Open Folder' button, the folder's files are all shown correctly in the FNC ListBox. All other features work correctly as in the demo. However, when the form is closed, I get an AV: 'AV at address 00499D03 in module skylgpro.exe . Read of address 00000000'.

Running the app in the debugger, after completion of Procedure TTMSFNCCustomScrollBar.TimerChanged in unit VCL.TMSFNCScrollBar, the following AV is generated at Line 428 in unit VCL.TMSFNCCloudBase.Win:

Exception

Any clues as to what the issue is here? The Demo works ok with no AV when using the feature. The 'Open Folder' procedure is a modified version of the Demo's procedure:

procedure TFormFNCCloudStorage.btOpenFolderClick(Sender: TObject);
var
ci: TTMSFNCCloudItem;
begin
//if TMSFNCCloudDemoListBox1.ItemIndex < 0 then
if TMSFNCListBox1.ItemIndex < 0 then
Exit;

//ci := TMSFNCCloudDemoListBox1.Items[TMSFNCCloudDemoListBox1.ItemIndex].DataObject as TTMSFNCCloudItem;
ci := TMSFNCListBox1.Items[TMSFNCListBox1.ItemIndex].DataObject as TTMSFNCCloudItem;

if ci.ItemType = ciFolder then
begin
CurrentFolder := ci;
lPath.Caption := lPath.Caption + '' + ci.FileName;
TMSFNCCloudStorageServices1.GetFolderListHierarchical(CurrentFolder);
end;
end;

This means that at least at moment of execution, Google returns a status different from 20* on opening this specific URL.
Is this repeatedly happening?
If so, can you send a modified demo + steps with which we can reproduce this here?

Yes, it happens every time. I'll try and send you a demo that reproduces the issue.

Done. Where should I send the zipped demo as it contains private data?

Ok, sent it to TMS software help@tmssoftware.com with instructions.

This problem occurs with OneDrive as well when opening a folder two levels down from the root. As with Google Drive, a large number of memory leaks are also reported after the app is closed. Have you been able to reproduce this with my demo? As the TMS demo seems to work normally, I wonder if the use of a FNC ListView in my app is responsible?

In these circumstances with my app, in Fiddler I see a Result 408 in a POST from Process Wermgr:14004 to URL 'https://umwatson.events.data.microsoft.com/Telemetry.Request /' with Response:

'The request body did not contain the specified number of bytes. Got 0, expected 4,692'

Does this help?

Exactly the same problem with Dropbox!

Hi,

It seems strange that the error does not occur in our demos. Do you have special characters in the file/folder you want to open/download? Is another program interfering with the proces? It could potentially be due to Fiddler that is opened at the same time.

Hello Pieter. No strange characters in Folder/File names and most times I don't have Fiddler open when this occurs. My demo - Backup_Demo TMS.zip sent to help@tmssoftware.com on August 14 - shows that it can't be another program interfering with the process. The main difference between our demos is that I use a TMSFNCListBox whereas you use a custom ListBox. Given that the AV seems related to unit VCL.TMSFNCScrollBar (see first post), could the scrollbar in the TMSFNCListBox be the problem?

Maybe this eurekalog error report after closing my demo will indicate where the problem is? The error only occurs if the 'Open Folder' button is clicked and the files are displayed - just like in my main app:

EurekaLog 7.9.4.1 update 4 hotfix 1 E413B0D726060A4C9B52854DE0A3AEBD 1185C60E69A8A64A8938CCBCCEAC4611 DA39A3EE5E6B4B0D3255BFEF95601890AFD80709 E4BE5E410B82CC4A9DA27CCD4C2065DE

Application:

1.1 Start Date : Mon, 23 Aug 2021 12:00:21 +0000
1.2 Name/Description: Backup_Demo.exe - (Backup_Demo)
1.3 Version Number : 1.0.0.0
1.4 Parameters :
1.5 Compilation Date: Mon, 23 Aug 2021 12:00:18 +0000
1.6 Up Time : 55 second(s)

Exception:

2.1 Date : Mon, 23 Aug 2021 12:01:16 +0000
2.2 Address : 00557DDB
2.3 Module Name : Backup_Demo.exe - (Backup_Demo)
2.4 Module Version: 1.0.0.0
2.5 Type : EAccessViolation
2.6 Message : Access violation at address 00557DDB in module 'Backup_Demo.exe'. Read of address DEADBEEF.
2.7 ID : 1FC9AEB7
2.8 Count : 1
2.11 Sent : 0

User:

3.2 Name : ...
3.3 Email: ...

Computer:

5.9 Display DPI: 96

Steps to reproduce:

8.1 Text:

Call Stack Information:

|Methods |Details|Stack |Address |Module |Offset |Source |Unit |Class |Procedure/Method |Line |

|*Exception Thread: ID=20416; Parent=0; Priority=0 |
|Class=; Name=MAIN |
|DeadLock=0; Wait Chain= |

Comment=
7FFFFFFE
00004020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000060
00000060
00000060
00000020
00000020
00000020
00000020
00000020
00000060
00000020
00000060
00000060
00000020
00000020
00000020
00000060
00000060
00000020
00000060
00000020
00000020
00000020
00000020
00000060
00000060
00000020
00000020
00000060
00000060
00000060
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000020
00000060
00000020
00000020
00000060
00000020
00000020
00000060
00000060
00000060
00000020
00000020
00000020
00000020
00000060
00000020
00000060
00000020
00000020
00000020
00000030
00004020
7FFF7FFE

Modules Information:

|Handle |Name |Description |Version |Size |Modified |Path |

|00400000|Backup_Demo.exe |Backup_Demo |1.0.0.0 |44295006|2021-08-23 12:00:14|E:\Skylog Project\Skylog V7\Utilities\Backup_Demo TMS\Win32\Debug\ |
|086E0000|crypt32.dll |Crypto API32 |10.0.19041.844 |1044304 |2021-03-11 10:01:07|C:\Windows\System32\ |
|56510000|Faultrep.dll |Windows User Mode Crash Reporting DLL |10.0.19041.1081 |410088 |2021-07-07 09:16:48|C:\Windows\System32\ |
|56780000|OneCoreUAPCommonProxyStub.dll |OneCoreUAP Common Proxy Stub |10.0.19041.1023 |3824712 |2021-06-09 11:22:39|C:\Windows\System32\ |
|56B20000|OneCoreCommonProxyStub.dll |OneCore Common Proxy Stub |10.0.19041.1081 |231936 |2021-07-07 09:16:45|C:\Windows\System32\ |
|56C50000|Windows.StateRepositoryPS.dll |Windows StateRepository Proxy/Stub Server |10.0.19041.844 |602176 |2021-03-11 10:01:06|C:\Windows\System32\ |
|56CF0000|edputil.dll |EDP util |10.0.19041.546 |93696 |2020-10-14 18:46:02|C:\Windows\System32\ |
|57D30000|ondemandconnroutehelper.dll |On Demand Connctiond Route Helper |10.0.19041.546 |56832 |2020-10-14 18:45:57|C:\Windows\System32\ |
|582A0000|mlang.dll |Multi Language Support DLL |10.0.19041.746 |198656 |2021-01-13 09:40:46|C:\Windows\System32\ |
|665D0000|policymanager.dll |Policy Manager DLL |10.0.19041.1151 |535568 |2021-08-11 09:48:35|C:\Windows\System32\ |
|67FC0000|idndl.dll |Downlevel DLL |10.0.19041.1 |8192 |2019-12-07 09:09:29|C:\Windows\System32\ |
|689C0000|msvcp110_win.dll |Microsoft® STL110 C++ Runtime Library |10.0.19041.546 |408000 |2020-10-14 18:45:55|C:\Windows\System32\ |
|6EDF0000|ncrypt.dll |Windows NCrypt Router |10.0.19041.546 |130128 |2020-10-14 18:46:02|C:\Windows\System32\ |
|6EE20000|ntasn1.dll |Microsoft ASN.1 API |10.0.19041.546 |161608 |2020-10-14 18:46:02|C:\Windows\System32\ |
|6EE50000|schannel.dll |TLS / SSL Security Provider |10.0.19041.789 |468992 |2021-02-10 09:37:56|C:\Windows\System32\ |
|6EFD0000|winnsi.dll |Network Store Information RPC interface |10.0.19041.546 |28360 |2020-10-14 18:45:50|C:\Windows\System32\ |
|6F110000|WinTypes.dll |Windows Base Types DLL |10.0.19041.1081 |896064 |2021-07-07 09:16:47|C:\Windows\System32\ |
|6F1F0000|CoreMessaging.dll |Microsoft CoreMessaging Dll |10.0.19041.867 |630592 |2021-03-11 10:01:07|C:\Windows\System32\ |
|6F290000|CoreUIComponents.dll |Microsoft Core UI Components Dll |10.0.19041.546 |2621720 |2020-10-14 18:45:57|C:\Windows\System32\ |
|6F510000|textinputframework.dll |"TextInputFramework.DYNLINK" |10.0.19041.1151 |753064 |2021-08-11 09:48:34|C:\Windows\System32\ |
|6F5D0000|rasadhlp.dll |Remote Access AutoDial Helper |10.0.19041.546 |12800 |2020-10-14 18:46:04|C:\Windows\System32\ |
|6F5E0000|FWPUCLNT.DLL |FWP/IPsec User-Mode API |10.0.19041.964 |342016 |2021-05-12 09:45:50|C:\Windows\System32\ |
|6F640000|dnsapi.dll |DNS Client API DLL |10.0.19041.1151 |587224 |2021-08-11 09:48:35|C:\Windows\System32\ |
|6F6E0000|cryptnet.dll |Crypto Network Related API |10.0.19041.906 |145144 |2021-04-14 09:38:18|C:\Windows\System32\ |
|6F730000|propsys.dll |Microsoft Property System |7.0.19041.1023 |791808 |2021-06-09 11:22:39|C:\Windows\System32\ |
|6F830000|urlmon.dll |OLE32 Extensions for Win32 |11.0.19041.1151 |1679872 |2021-08-11 09:48:35|C:\Windows\System32\ |
|6FA70000|iertutil.dll |Run time utility for Internet Explorer |11.0.19041.1081 |2269488 |2021-07-07 09:16:48|C:\Windows\System32\ |
|701C0000|dpapi.dll |Data Protection API |10.0.19041.546 |13312 |2020-10-14 18:46:02|C:\Windows\System32\ |
|701D0000|srvcli.dll |Server Service Client DLL |10.0.19041.546 |76952 |2020-10-14 18:46:02|C:\Windows\System32\ |
|70500000|dwmapi.dll |Microsoft Desktop Window Manager API |10.0.19041.746 |138936 |2021-01-13 09:40:43|C:\Windows\System32\ |
|706F0000|TextShaping.dll | | |611952 |2021-03-11 10:01:05|C:\Windows\System32\ |
|707B0000|ncryptsslp.dll |Microsoft SChannel Provider |10.0.19041.546 |117216 |2020-10-14 18:46:02|C:\Windows\System32\ |
|707D0000|mskeyprotect.dll |Microsoft Key Protection Provider |10.0.19041.964 |53760 |2021-05-12 09:45:50|C:\Windows\System32\ |
|70850000|winsta.dll |Winstation Library |10.0.19041.546 |270640 |2020-10-14 18:45:56|C:\Windows\System32\ |
|70FC0000|uxtheme.dll |Microsoft UxTheme Library |10.0.19041.1081 |454656 |2021-07-07 09:16:46|C:\Windows\System32\ |
|71F10000|GdiPlus.dll |Microsoft GDI+ |10.0.19041.1151 |1459712 |2021-07-31 20:45:46|C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.1151_none_d951395de104724f\ |
|720C0000|comctl32.dll |User Experience Controls Library |6.10.19041.1110 |2152264 |2021-07-09 08:47:26|C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_a8625c1886757984|
|72340000|winspool.drv |Windows Spooler Driver |10.0.19041.1023 |423936 |2021-06-09 11:22:36|C:\Windows\System32\ |
|73E60000|ntmarta.dll |Windows NT MARTA provider |10.0.19041.546 |152904 |2020-10-14 18:46:02|C:\Windows\System32\ |
|73E90000|netutils.dll |Net Win32 API Helpers DLL |10.0.19041.546 |37176 |2020-10-14 18:46:02|C:\Windows\System32\ |
|73EA0000|rsaenh.dll |Microsoft Enhanced Cryptographic Provider |10.0.19041.1052 |184888 |2021-06-09 11:22:40|C:\Windows\System32\ |
|73ED0000|cryptsp.dll |Cryptographic Service Provider API |10.0.19041.546 |68192 |2020-10-14 18:46:02|C:\Windows\System32\ |
|74180000|winhttp.dll |Windows HTTP Services |10.0.19041.1151 |816536 |2021-08-11 09:48:35|C:\Windows\System32\ |
|74250000|netapi32.dll |Net Win32 API DLL |10.0.19041.546 |68680 |2020-10-14 18:45:56|C:\Windows\System32\ |
|74270000|sspicli.dll |Security Support Provider Interface |10.0.19041.906 |123480 |2021-04-14 09:38:16|C:\Windows\System32\ |
|742A0000|secur32.dll |Security Support Provider Interface |10.0.19041.546 |23040 |2020-10-14 18:46:03|C:\Windows\System32\ |
|742B0000|profapi.dll |User Profile Basic API |10.0.19041.844 |89360 |2021-03-11 10:01:03|C:\Windows\System32\ |
|742D0000|dbgcore.dll |Windows Core Debugging Helpers |10.0.19041.546 |138752 |2020-10-14 18:46:02|C:\Windows\System32\ |
|74300000|dbghelp.dll |Windows Image Helper |10.0.19041.1052 |1494016 |2021-06-09 11:22:40|C:\Windows\System32\ |
|74490000|wldp.dll |Windows Lockdown Policy |10.0.19041.662 |139960 |2020-12-08 17:07:31|C:\Windows\System32\ |
|74640000|windows.storage.dll |Microsoft WinRT Storage API |10.0.19041.1151 |6361176 |2021-08-11 09:48:34|C:\Windows\System32\ |
|74C80000|msasn1.dll |ASN.1 Runtime APIs |10.0.19041.546 |50616 |2020-10-14 18:46:02|C:\Windows\System32\ |
|74C90000|version.dll |Version Checking and File Installation Libraries |10.0.19041.546 |27320 |2020-10-14 18:46:04|C:\Windows\System32\ |
|74D80000|wininet.dll |Internet Extensions for Win32 |11.0.19041.1151 |4504064 |2021-08-11 09:48:35|C:\Windows\System32\ |
|751E0000|CRYPTBASE.dll |Base cryptographic API DLL |10.0.19041.546 |31528 |2020-10-14 18:45:55|C:\Windows\System32\ |
|751F0000|winmm.dll |MCI API DLL |10.0.19041.546 |149272 |2020-10-14 18:45:55|C:\Windows\System32\ |
|75220000|mswsock.dll |Microsoft Windows Sockets 2.0 Service Provider |10.0.19041.546 |324416 |2020-10-14 18:46:01|C:\Windows\System32\ |
|75280000|kernel.appcore.dll |AppModel API Host |10.0.19041.546 |52672 |2020-10-14 18:45:59|C:\Windows\System32\ |
|75290000|umpdc.dll | | |47472 |2020-10-14 18:45:59|C:\Windows\System32\ |
|752A0000|powrprof.dll |Power Profile Helper DLL |10.0.19041.546 |268080 |2020-10-14 18:46:02|C:\Windows\System32\ |
|752F0000|wtsapi32.dll |Windows Remote Desktop Session Host Server SDK APIs|10.0.19041.546 |52664 |2020-10-14 18:45:56|C:\Windows\System32\ |
|75300000|IPHLPAPI.DLL |IP Helper API |10.0.19041.546 |196784 |2020-10-14 18:46:01|C:\Windows\System32\ |
|75340000|win32u.dll |Win32u |10.0.19041.1151 |92944 |2021-08-11 09:48:35|C:\Windows\System32\ |
|75360000|comdlg32.dll |Common Dialogues DLL |10.0.19041.906 |688128 |2021-04-14 09:38:20|C:\Windows\System32\ |
|75410000|KERNELBASE.dll |Windows NT BASE API Client DLL |10.0.19041.1151 |2182680 |2021-08-11 09:48:30|C:\Windows\System32\ |
|756F0000|bcrypt.dll |Windows Cryptographic Primitives Library |10.0.19041.1023 |96032 |2021-06-09 11:22:40|C:\Windows\System32\ |
|75710000|msvcp_win.dll |Microsoft® C Runtime Library |10.0.19041.789 |495840 |2021-02-10 09:37:56|C:\Windows\System32\ |
|75790000|shell32.dll |Windows Shell Common Dll |10.0.19041.1151 |6001232 |2021-08-11 09:48:36|C:\Windows\System32\ |
|75D50000|kernel32.dll |Windows NT BASE API Client DLL |10.0.19041.1151 |632560 |2021-08-11 09:48:33|C:\Windows\System32\ |
|75F50000|cfgmgr32.dll |Configuration Manager DLL |10.0.19041.1151 |236536 |2021-08-11 09:48:35|C:\Windows\System32\ |
|75F90000|SHCore.dll |SHCORE |10.0.19041.1023 |548528 |2021-06-09 11:22:40|C:\Windows\System32\ |
|76020000|nsi.dll |NSI User-mode interface DLL |10.0.19041.610 |20144 |2020-11-11 09:34:11|C:\Windows\System32\ |
|76030000|rpcrt4.dll |Remote Procedure Call Runtime |10.0.19041.1081 |781432 |2021-07-07 09:16:45|C:\Windows\System32\ |
|760F0000|msvcrt.dll |Windows NT CRT DLL |7.0.19041.546 |775256 |2020-10-14 18:45:55|C:\Windows\System32\ |
|761B0000|sechost.dll |Host for SCM/SDDL/LSA Lookup APIs |10.0.19041.906 |475712 |2021-04-14 09:38:16|C:\Windows\System32\ |
|76230000|imm32.dll |Multi-User Windows IMM32 API Client DLL |10.0.19041.546 |143056 |2020-10-14 18:46:02|C:\Windows\System32\ |
|76260000|combase.dll |Microsoft COM for Windows |10.0.19041.1081 |2635664 |2021-07-07 09:16:47|C:\Windows\System32\ |
|764F0000|ws2_32.dll |Windows Socket 2.0 32-Bit DLL |10.0.19041.546 |397728 |2020-10-14 18:45:55|C:\Windows\System32\ |
|76560000|oleaut32.dll |OLEAUT32.DLL |10.0.19041.985 |606888 |2021-05-12 09:45:50|C:\Windows\System32\ |
|76600000|imagehlp.dll |Windows NT Image Helper |10.0.19041.546 |95496 |2020-10-14 18:45:50|C:\Windows\System32\ |
|76620000|gdi32full.dll |GDI Client DLL |10.0.19041.1110 |895040 |2021-07-14 09:50:07|C:\Windows\System32\ |
|76700000|ucrtbase.dll |Microsoft® C Runtime Library |10.0.19041.789 |1181208 |2021-02-10 09:37:56|C:\Windows\System32\ |
|76820000|shlwapi.dll |Shell Light-weight Utility Library |10.0.19041.1023 |275808 |2021-06-09 11:22:41|C:\Windows\System32\ |
|768D0000|clbcatq.dll |COM+ Configuration Catalog |2001.12.10941.16384|504552 |2020-10-14 18:46:00|C:\Windows\System32\ |
|76950000|ole32.dll |Microsoft OLE for Windows |10.0.19041.746 |924528 |2021-01-13 09:40:43|C:\Windows\System32\ |
|76A40000|bcryptPrimitives.dll |Windows Cryptographic Primitives Library |10.0.19041.1023 |383760 |2021-06-09 11:22:31|C:\Windows\System32\ |
|76AA0000|gdi32.dll |GDI Client DLL |10.0.19041.746 |136328 |2021-01-13 09:40:36|C:\Windows\System32\ |
|76AD0000|advapi32.dll |Advanced Windows 32 Base API |10.0.19041.1052 |489656 |2021-06-09 11:22:36|C:\Windows\System32\ |
|76F90000|normaliz.dll |Unicode Normalization DLL |10.0.19041.546 |5120 |2020-10-14 18:46:02|C:\Windows\System32\ |
|76FA0000|wintrust.dll |Microsoft Trust Verification APIs |10.0.19041.1151 |289184 |2021-08-11 09:48:34|C:\Windows\System32\ |
|771F0000|user32.dll |Multi-User Windows USER API Client DLL |10.0.19041.1151 |1663656 |2021-08-11 09:48:35|C:\Windows\System32\ |
|77390000|msctf.dll |MSCTF Server DLL |10.0.19041.1081 |859944 |2021-07-07 09:16:46|C:\Windows\System32\ |
|77470000|psapi.dll |Process Status Helper |10.0.19041.546 |17016 |2020-10-14 18:46:00|C:\Windows\System32\ |
|77490000|ntdll.dll |NT Layer DLL |10.0.19041.1110 |1696752 |2021-07-14 09:50:06|C:\Windows\System32\ |
|7A800000|olepro32.dll |OLEPRO32.DLL |10.0.19041.84 |88576 |2020-09-25 15:37:46|C:\Windows\System32\ |
|7AF40000|wer.dll |Windows Error Reporting DLL |10.0.19041.1081 |711760 |2021-07-07 09:16:48|C:\Windows\System32\ |
|7B9B0000|dbghelp.dll |Windows Image Helper |10.0.16299.91 |1449272 |2018-06-14 02:20:16|E:\EurekaLog 7\Bin\ |
|7BB40000|symsrv.dll |Microsoft Symbol Server |10.0.16299.91 |169784 |2018-06-14 01:48:24|E:\EurekaLog 7\Bin\ |
|7C1D0000|Windows.Shell.ServiceHostBuilder.dll|Windows.Shell.ServiceHostBuilder |10.0.19041.746 |75264 |2021-01-13 09:40:39|C:\Windows\System32\ |

Processes Information:

Assembler Information:

; Base Address: $557000, Allocation Base: $400000, Region Size: 7593984
; Allocation Protect: PAGE_EXECUTE_WRITECOPY, Protect: PAGE_EXECUTE_READ
; State: MEM_COMMIT, Type: MEM_IMAGE
;
;
; System.TComponent.RemoveFreeNotifications (Line=16739 - Offset=8)
; -----------------------------------------------------------------
00557DB0 837B1400 CMP DWORD PTR [EBX+$14], 0
00557DB4 7451 JZ +$51 ; ($00557E07) System.TComponent.RemoveFreeNotifications (Line=16745)
00557DB6 EB28 JMP +$28 ; ($00557DE0) System.TComponent.RemoveFreeNotifications (Line=16741)
;
; Line=16742 - Offset=16
; ----------------------
00557DB8 8BFE MOV EDI, ESI
00557DBA 8B4608 MOV EAX, [ESI+8]
00557DBD 48 DEC EAX
00557DBE 890424 MOV [ESP], EAX
00557DC1 8B4708 MOV EAX, [EDI+8]
00557DC4 3B0424 CMP EAX, [ESP]
00557DC7 7705 JA +5 ; ($00557DCE) System.TComponent.RemoveFreeNotifications (Line=16742)
00557DC9 E8A28AF6FF CALL -$09755E ; ($004C0870) System.Generics.ErrorArgumentOutOfRange
00557DCE 8B4704 MOV EAX, [EDI+4]
00557DD1 8B1424 MOV EDX, [ESP]
00557DD4 8B0490 MOV EAX, [EAX+EDX*4]
00557DD7 B101 MOV CL, 1
00557DD9 8BD3 MOV EDX, EBX
;
; Line=16742 - Offset=51
; ----------------------
00557DDB 8B30 MOV ESI, [EAX] ; <-- EXCEPTION
00557DDD FF5614 CALL DWORD PTR [ESI+$14]
;
; Line=16741 - Offset=56
; ----------------------
00557DE0 8B7314 MOV ESI, [EBX+$14]
00557DE3 85F6 TEST ESI, ESI
00557DE5 7406 JZ +6 ; ($00557DED) System.TComponent.RemoveFreeNotifications (Line=16743)
00557DE7 837E0800 CMP DWORD PTR [ESI+8], 0
00557DEB 7FCB JG -$35 ; ($00557DB8) System.TComponent.RemoveFreeNotifications (Line=16742)
;
; Line=16743 - Offset=69
; ----------------------
00557DED 8D4314 LEA EAX, [EBX+$14]
00557DF0 89442404 MOV [ESP+4], EAX
00557DF4 8B442404 MOV EAX, [ESP+4]
00557DF8 8B00 MOV EAX, [EAX]
00557DFA 8B542404 MOV EDX, [ESP+4]
00557DFE 33C9 XOR ECX, ECX
00557E00 890A MOV [EDX], ECX
00557E02 E8711BEBFF CALL -$14E48F ; ($00409978->0045B4B0) EMemLeaks._TObjectFreeHook
;
; Line=16745 - Offset=95
; ----------------------
00557E07 59 POP ECX
00557E08 5A POP EDX

Registers:

EAX: DEADBEEF EDI: 04D30CC8
EBX: 04C70B10 ESI: 04D30CC8
ECX: 0029C101 EBP: 04C70B10
EDX: 04C70B10 ESP: 0019F144
EIP: 00557DDB FLG: 00210202
EXP: 00557DDB STK: 0019F144

Stack: Memory Dump:


0019F180: 0019F198 00557DDB: 8B 30 FF 56 14 8B 73 14 85 F6 74 06 83 7E 08 00 .0.V..s...t..~..
0019F17C: 005438E8 00557DEB: 7F CB 8D 43 14 89 44 24 04 8B 44 24 04 8B 00 8B ...C..D$..D$....
0019F178: 04C70BCC 00557DFB: 54 24 04 33 C9 89 0A E8 71 1B EB FF 59 5A 5F 5E T$.3....q...YZ_^
0019F174: 04C70B94 00557E0B: 5B C3 8D 40 00 53 56 57 83 C4 F4 8B F2 8B D8 8B [..@.SVW........
0019F170: 04C70B84 00557E1B: 43 04 85 C0 74 05 3B 46 04 74 4F 83 7B 14 00 75 C...t.;F.tO.{..u
0019F16C: 04C70B90 00557E2B: 0F B2 01 A1 C4 B2 52 00 E8 E0 95 00 00 89 43 14 ......R.......C.
0019F168: 04C70B88 00557E3B: 8B 43 14 8B FE 89 3C 24 83 C0 04 89 44 24 04 8B .C....<$....D$..
0019F164: 006D1686 00557E4B: D4 8B 44 24 04 E8 13 9A F6 FF 85 C0 7D 1C 8B 43 ..D$........}..C
0019F160: 00000000 00557E5B: 14 89 7C 24 08 8D 54 24 08 83 C0 04 E8 AC A6 F6 ..|$..T$........
0019F15C: 00000000 00557E6B: FF 8B D3 8B C6 E8 9B FF FF FF 66 81 4B 1C 00 01 ..........f.K...
0019F158: 00557C09 00557E7B: 83 C4 0C 5F 5E 5B C3 8B C0 53 56 51 8B D8 F6 43 ..._^[...SVQ...C
0019F154: 05483E00 00557E8B: 1C 10 75 2C C6 04 24 00 53 68 C0 7E 55 00 8D 54 ..u,..$.Sh.~U..T
0019F150: 04C70B10 00557E9B: 24 08 8B C3 E8 40 03 00 00 80 3C 24 00 75 11 53 $....@....<$.u.S
0019F14C: 04C70B10 00557EAB: 68 C0 7E 55 00 8B C3 66 BE FA FF E8 C1 1E EB FF h.~U...f........
0019F148: 04C70B10 00557EBB: 5A 5E 5B C3 90 92 E8 8E 0D FF FF C3 90 53 56 8B Z^[..........SV.
0019F144: 00000014 00557ECB: F2 8B D8 8B C6 E8 23 61 FF FF 66 89 43 18 5E 5B ......#a..f.C.^[

Looking back at the first post, I noticed the URL in the exception window is not properly formatted. Are you sure that in your demo, you have properly formatted the URL? No manipulations or any other decoding/encoding has happened?

I'm not formatting any url's in the demo, so it's not anything I'm doing afaik. I'll continue investigating and let you know if I find anything. I feel sure it's something I've missed when modifying your demo for my app.

Progress: the issue is to do with the freeing of the FNC Listbox items. When closing the demo app's form, Eurekalog reports an error in system.classes with TComponent procedure RemoveNotification only after the selected folder's files have been displayed using 'Open Folder'. The error takes you to::

procedure TComponent.RemoveNotification(const AComponent: TComponent);
var
Count: Integer;
begin
if FFreeNotifies <> nil then
begin
Count := FFreeNotifies.Count;
if Count > 0 then
begin
{ On destruction usually the last item is deleted first }
if FFreeNotifies[Count - 1] = AComponent then
FFreeNotifies.Delete(Count - 1)
else
FFreeNotifies.Remove(AComponent);
end;
if FFreeNotifies.Count = 0 then
FreeAndNil(FFreeNotifies);
end;
end;

It seems to my newbie eye that the new FNC ListBox items may have been freed before the action of closing the form tries to freeandnil them again - hence the AV perhaps? The FNC Demo ListBox doesn't have this problem - perhaps that's why a special ListBox was required.

Hi,

The reason why a custom listbox is used is because the TMS FNC Cloud Pack can be used seperately and without access to the TTMSFNCListbox which is part of the TMS FNC UI Pack. Either way, we have tried replacing the listbox with a TTMSFNCListBox, converting the code and could not see an issue after clicking on "Open Folder", closing the application does not throw an access violation.

CloudStorageServiceDemoVCL.zip (56.1 KB)

Ok, comparing your code with mine, this is the code in procedure TFormFNCCloudStorage.FillListBox causing the problem - as suggested in the Different Font for Folder support issue (Aug 13) :

Example:
Var lit: TTMSFNCListBoxItem;

TMSFNCListBox1.BeginUpdate;
TMSFNCListBox1.Items.Clear;
for I := 0 to AItems.Count - 1 do
begin
ci := AItems.Items[I];
lit := TMSFNCListBox1.AddItem(AItems.Items[I].FileName);
if ci.ItemType = ciFolder then
lit.TextColor := gcRed;
lit.DataObject := ci;
end;
TMSFNCListBox1.EndUpdate;

Using the Demo code (and removing Folder font colouring) fixes the problem:
:...
if ((ci.ItemType = ciFolder) and AAddFolders) or ((ci.ItemType = ciFile) and AAddFiles) then
TMSFNCListBox1.AddItem(AItems.Items[I].Filename).DataObject := ci;

I'm obviously using the code snippet incorrectly. What is the correct way to add Folder font colour?

Are you 100% sure that the DataObject property is always assigned, because in the other code snippets, the DataObject property needs to be assigned. Otherwise you will get an access violation. It's also strange that setting the TextColor would affect getting an access violation or not.

Yes:

procedure TFormFNCCloudStorage.FillListBox(AItems: TTMSFNCCloudItems; AAddFolders,
AAddFiles: Boolean);
var
I: Integer;
ftype: string;
ci: TTMSFNCCloudItem;
lit: TTMSFNCListBoxItem;
begin
if not Assigned(AItems) then
Exit;

//TMSFNCCloudDemoListBox1.BeginUpdate;
TMSFNCListBox1.BeginUpdate;
for I := 0 to AItems.Count - 1 do
...
Well, using:
if ((ci.ItemType = ciFolder) and AAddFolders) or ((ci.ItemType = ciFile) and AAddFiles) then
TMSFNCListBox1.AddItem(AItems.Items[I].Filename).DataObject := ci;
No AV.

using:
if ((ci.ItemType = ciFolder) and AAddFolders) or ((ci.ItemType = ciFile) and AAddFiles) then
lit := TMSFNCListBox1.AddItem(AItems.Items[I].FileName);
if ci.ItemType = ciFolder then
lit.TextColor := gcBrown;//gcRed;
lit.DataObject := ci;

AV after clicking 'Open Folder'. If I add this code to the demo you sent this morning, I get 2 AVs when closing down. BTW, I'm using Delphi 10.4.2.

I have modified the code to:

procedure TForm4.FillListBox(AItems: TTMSFNCCloudItems; AAddFolders,
  AAddFiles: Boolean);
var
  I: Integer;
  ftype: string;
  ci: TTMSFNCCloudItem;
  lit: TTMSFNCListBoxItem;
begin
  if not Assigned(AItems) then
    Exit;

  TMSFNCCloudDemoListBox1.BeginUpdate;
  for I := 0 to AItems.Count - 1 do
  begin
    ci := AItems.Items[I];
    ftype := LowerCase(StringReplace(ExtractFileExt(ci.FileName), '.', '', [rfReplaceAll]));
    if AItems.Items[I].ItemType = ciFolder then
      ftype := 'folder'
    else if ftype = '' then
      ftype := 'file';

//    if not TMSFNCCloudDemoListBox1.SupportsFileType(ftype) then
//      ftype := 'file';

    if ((ci.ItemType = ciFolder) and AAddFolders) or ((ci.ItemType = ciFile) and AAddFiles) then
    begin
      lit := TMSFNCCloudDemoListBox1.AddItem(AItems.Items[I].FileName);
      if ci.ItemType = ciFolder then
        lit.TextColor := gcBrown;//gcRed;
      lit.DataObject := ci;
    end;

  end;
  TMSFNCCloudDemoListBox1.EndUpdate;
end;

and don't get an access violation. I'm not sure what is going wrong in your project.

CloudStorageServiceDemoVCL_v2.zip (27.9 KB)

Thanks Pieter but the difference between our projects is that I'm using a TMSFNCListBox whereas you are using a TMSFNCCloudDemoListBox. I don't want to use a TMSFNCCloudDemoListBox because it won't be updated when FNC Cloud Pack is updated. My AVs are caused by using Folder font colour assignments with a TMSFNCListBox.

The attached v2 demo project I changed is using TTMSFNCListBox, I just changed the name to TMSFNCCloudDemoListBox1 to avoid having to update all the code. Look at the hint below

image