Closed srd-software closed 4 years ago
There does not seem to be much activity in these "issues" sections, so I revisited this problem again and am posting what I found out. I am using Version: 5.7 of the dragdrop components dated 28-FEB-2015 (version and date are from the header of the DragDropFormats.pas file).
This error was happening in DragDropFormats.pas at line 1295. I played around with it and found by adding this:
IStream(AMedium.stm) := nil;
Right after the line containing AMedium.tymed := TYMED_ISTREAM;, it seems to have fixed the error without any side effects. So far. I added this info in case it can help someone else having the same problem, but I am not sure it's the "correct" solution!
AMedium.stm := Stream;
should the solution on line 1297
Thank you
That seems to work as well. I changed my file line 1297 to what you have.
Thanks
i will push the fix tomorrow
can you check the new sources again please
On my simple test app I'm getting the leak error in madexcept again with the latest DragDropFormats. I'll put the report in below. It throws an error in madexcept but not in Delphi.
allocation number: 2540 program up time: 14.97 s type: TFixedStreamAdapter address: $59c6fd8 size: 36 access rights: read/write reference counter: 3
main thread ($5c60): 671a52b3 madExcept32.dll madExceptDbg 1736 GetMemCallback 0040c948 Project1.exe System 34385 InvokeRecordConstructor 00406ec8 Project1.exe System 4799 @GetMem 00408712 Project1.exe System 17394 TObject.NewInstance 00410020 Project1.exe System 39278 TInterfacedObject.NewInstance 00408ed7 Project1.exe System 18773 @ClassCreate 004eab79 Project1.exe System.Classes 17102 TStreamAdapter.Create 00663091 Project1.exe Vcl.AxCtrls 1003 TOleStream.Create 00667080 Project1.exe DragDropFormats 1296 TCustomSimpleClipboardFormat.DoSetData 0066e669 Project1.exe DragDrop 1129 TClipboardFormat.SetDataToMedium 0066e690 Project1.exe DragDrop 1136 TClipboardFormat.SetData 006669d8 Project1.exe DragDropFormats 1012 TCustomSimpleClipboardFormat.Create 0066b7b6 Project1.exe DropTarget 1515 TCustomDropTarget.SetPerformedDropEffect 0066a30a Project1.exe DropTarget 880 TCustomDropTarget.DoDrop 0066a1b8 Project1.exe DropTarget 766 TCustomDropTarget.Drop 75d54c7b RPCRT4.dll NdrStubCall2 76c4b3cc combase.dll CStdStubBuffer_Invoke 761d37cb USER32.dll DispatchMessageW 006565c7 Project1.exe Vcl.Forms 10724 TApplication.ProcessMessage
memory dump: 059c6fd8 c0 41 66 00 03 00 00 00 - 84 27 40 00 00 7b 9a 05 .Af......'@..{.. 059c6fe8 01 00 00 00 68 83 4b 00 - 00 00 00 00 0c 41 66 00 ....h.K......Af. 059c6ff8 00 00 00 00 ....
allocation number: 2538 program up time: 12.07 s type: GlobalAlloc handle: $7e40044 reference counter: 0 size: 4 access rights: read/write
main thread ($5c60): 671a69f6 madExcept32.dll madExceptDbg 2781 GlobalAllocCallback 00666fa1 Project1.exe DragDropFormats 1258 TCustomSimpleClipboardFormat.DoSetData 0066e669 Project1.exe DragDrop 1129 TClipboardFormat.SetDataToMedium 0066e690 Project1.exe DragDrop 1136 TClipboardFormat.SetData 006669d8 Project1.exe DragDropFormats 1012 TCustomSimpleClipboardFormat.Create 0066b7b6 Project1.exe DropTarget 1515 TCustomDropTarget.SetPerformedDropEffect 0066a30a Project1.exe DropTarget 880 TCustomDropTarget.DoDrop 0066a1b8 Project1.exe DropTarget 766 TCustomDropTarget.Drop 75d54c7b RPCRT4.dll NdrStubCall2 76c4b3cc combase.dll CStdStubBuffer_Invoke 761d37cb USER32.dll DispatchMessageW 006565c7 Project1.exe Vcl.Forms 10724 TApplication.ProcessMessage
memory dump: 0149dfa8 01 00 00 00 ....
Can you send me the source of this project to my mail displayed on my profile please?
i'm not sure, that is it a real memory leak, but only a madExcept problem. if I change the source code so that the "error" is gone, there are side effects elsewhere.
i'm not sure, that is it a real memory leak, but only a madExcept problem. if I change the source code so that the "error" is gone, there are side effects elsewhere.
It could be a "false positive" from madexcept. Might be something to take up with them so I'll post this on their forum. I'll also see if there's a way to just suppress the error. I tried that but had no luck, so I'll ask about that too.
I can suppress the madexcept errors doing the following:
Madexcept callstack:
main thread ($29d8):
671a69f6 madExcept32.dll madExceptDbg 2781 GlobalAllocCallback
0081a249 SRDJournal.exe DragDropFormats 1258 TCustomSimpleClipboardFormat.DoSetData
00821931 SRDJournal.exe DragDrop 1129 TClipboardFormat.SetDataToMedium
Add madexcept, DragDropFormats to Uses
Then in the TForm1.DropComboTarget1Drop procedure, add these lines:
HideLeak(TFixedStreamAdapter,2);
HideLeak('GlobalAlloc|GlobalAllocCallback|TCustomSimpleClipboardFormat.DoSetData|TClipboardFormat.SetDataToMedium');
That still works to suppress the error and it will only be suppressed when it has that combination of lines in the callstack (GlobalAlloc|GlobalAllocCallback etc.) and not suppress other GlobalAlloc errors.
You can add the HideLeak in just the Drop procedure as the errors only seem to crop up when I drop a file.
Hopefully this will help.
thank you, i have added a note in the appropriate place
I'm using the latest dragdrop files in Rio 10.3. I can set up a simple app with a tmemo and a combo drop target, setting the target to memo1. I can drag and drop a file no problem. However, if I have madExcept running reporting leaks, I keep getting 2 errors. One is type TFixedStreamAdapter and the second is GlobalAlloc. I'll put in a screenshot below. I'm not getting any delphi errors.
If I don't have madExcept reporting leaks in the project, there are no delphi errors reported and it all appears to run correctly.
Any ideas appreciated!