TurboPack / MustangpeakVirtualshellTools

Delphi and CBuilder Components to create Explorer type programs
Other
49 stars 24 forks source link

VirtualExplorerCombobox - Scrollbar with Memory Leak #24

Closed RenaldoGlobe closed 2 years ago

RenaldoGlobe commented 2 years ago

The latest Github version of the unit "VirtualScrollbars.pas" provides styled scrollbars. This is very nice. But the scrollbar of the VirtulalExplorerCombobox, with or without assigned style, looks very strange. The reason for that is probably a wrong scrollbar background color.

I replaced the following line in the Procedure TCustomOwnerDrawScrollbar.DoPaintScrollButton: Line 576 - old: lColorNew := lServices.GetSystemColor(clScrollBar); replaced with: lColorNew := lServices.GetSystemColor(clBtnface);

This looks much better, like a scrollbar.

Additionally, after a Dropdown of the VirtualExplorerCombobox, a Memory Leak occurs, when the application terminates. Therefore please add "ReportMemoryLeaksOnShutdown := true;" to the sourcecode.

It arises, because of the Line 577 -

BkGndBrush.Color := lColorNew;

If I change a color or a style from a TBrush, and the TBrush owns a Bitmap, the Bitmap Handle immediately get lost. But the Bitmap remains in memory. I can’t free it any more. (here: BkGndBrush.Bitmap)
Before I assign the new color to a TBrush, I have to free the „TBrush.Bitmap” by myself.

For example: „if assigned(BkGndBrush.Bitmap) then BkGndBrush.Bitmap.Free;”

Or much better, TBrush owns no Bitmap if not necessary.
Please have a look to the attached zip-file.
Maybe you have some better ideas.

(Windows 10, Delphi 11.1) Demo VExplorerCombo.zip

romankassebaum commented 2 years ago

Many thanks for the hint. I fixed it. Please check.

RenaldoGlobe commented 2 years ago

Yes, it works. Thank you for your effort.

Am .07.2022, 22:41 Uhr, schrieb Roman Kassebaum @.***>:

Many thanks for the hint. I fixed it. Please check.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.