View Issue Details

IDProjectCategoryView StatusLast Update
0038517LazarusLCLpublic2021-03-07 16:01
ReporterBenjamin Rosseaux Assigned Towp  
Status resolvedResolutionfixed 
Product Version2.1 (SVN) 
Summary0038517: Revision 64575 breaks LCLQt5+Windows in connection with AnchorDocking together with a docked-form with TTreeView
DescriptionRevision 64575 breaks LCLQt5+Windows in connection with AnchorDocking together with a docked-form with TTreeView

a AV occurs then in the ShellCtrls.pas somewhere at

     ico := GetShellIcon(WideString('C:'));
        Result := Types.Size(ico.Width, ico.Height);
        FBuiltinIconSize := Result;

in direction to the "ico.Free;" code line

This is inside a `{$ifdef mswindows}` block?

My suggestion would be to undo the changes in #64575, so that the Qt5 widgetset is fully usable under Windows again, and redo the #64575 changes on pure Win32-LCL-widgetset-implementation-level instead with a global `{$ifdef mswindows}` block inside the ShellCtrls.pas. Because this is not LCL-widgetset portable in my view.
TagsNo tags attached.
Fixed in Revision
WidgetsetWin32/Win64, QT5
Attached Files


Benjamin Rosseaux

2021-02-19 21:22

reporter   ~0129021

OK, when i renamed the mswindows define stuff to a other dummy name inside ShellCtrls.pas so it is ifdefed out, then my LCLQt5-based application is working again unter Windows.

Benjamin Rosseaux

2021-02-19 21:33

reporter   ~0129022

I've replaced

{$ifdef mswindows}


{$ifdef DEFINED(LCLWin32) or DEFINED(LCLWin64)}

in my patch now, and it seems to work.
shellctrls.pas.patch (761 bytes)   
Index: lcl/shellctrls.pas
--- lcl/shellctrls.pas	(revision 64623)
+++ lcl/shellctrls.pas	(working copy)
@@ -85,7 +85,7 @@
     procedure DoAddItem(const ABasePath: String; const AFileInfo: TSearchRec; var CanAdd: Boolean);
     function CanExpand(Node: TTreeNode): Boolean; override;
-  {$ifdef mswindows}
+  {$if DEFINED(LCLWin32) or DEFINED(LCLWin64)}
     FBuiltinIconSize: TSize;
@@ -1002,7 +1002,7 @@
     FOnAddItem(Self, ABasePath, AFileInfo, CanAdd);
-{$ifdef mswindows}
+{$ifdef DEFINED(LCLWin32) or DEFINED(LCLWin64)}
 { Extracts the windows shell icon of the specified file. }
 function GetShellIcon(const AFileName: WideString): TIcon;
shellctrls.pas.patch (761 bytes)   

Juha Manninen

2021-02-20 10:21

developer   ~0129032

What is the difference between
 {$ifdef mswindows}
 {$ifdef DEFINED(LCLWin32) or DEFINED(LCLWin64)}


2021-02-20 13:01

developer   ~0129034

You can build a LCL app using default Windows API - {$ifdef DEFINED(LCLWin32) or DEFINED(LCLWin64)}.

You can also use a other widgetset on Windows like QT5 - then you are still on Windows - {$ifdef mswindows} -, but this is also true {$IF DEFINED(LCLQt5)}.

Benjamin Rosseaux

2021-02-27 05:19

reporter   ~0129192

Any update on this?

The actually quick to make change in the lcl/shellctrls.pas from

{$ifdef mswindows}


{$if DEFINED(LCLWin32) or DEFINED(LCLWin64)}

as from my patch would be already enough to make Qt5 usable again with Lazarus under Windows.


2021-02-27 10:54

developer   ~0129195

Last edited: 2021-02-27 13:59

View 2 revisions

Ideally these IFDEFS should be avoided and the code should be moved to the widgetset. But since the unit already contains already lots of {$if defined(Windows)} I took the easy way...

However, applying your patch opens a lot of compilation issues on native Windows... Trying to put the code into the widgetset...


2021-02-28 12:19

developer   ~0129229

Deactivated the former Windows-dependent changes in ShellCtrls. Currently I am testing a widgetset-based solution.


2021-03-07 16:01

developer   ~0129485

Widgetset-based built-in solution for TShellTreeView in r64747 and for TShellListView in r64764. Both are windows-only at the moment. Should not interfere with "qt-on-windows" any more.

Resolving the issue. Please test and close if ok.

Issue History

Date Modified Username Field Change
2021-02-19 21:16 Benjamin Rosseaux New Issue
2021-02-19 21:22 Benjamin Rosseaux Note Added: 0129021
2021-02-19 21:33 Benjamin Rosseaux Note Added: 0129022
2021-02-19 21:33 Benjamin Rosseaux File Added: shellctrls.pas.patch
2021-02-20 10:21 Juha Manninen Note Added: 0129032
2021-02-20 10:24 Juha Manninen Assigned To => wp
2021-02-20 10:24 Juha Manninen Status new => assigned
2021-02-20 13:01 Michl Note Added: 0129034
2021-02-27 05:19 Benjamin Rosseaux Note Added: 0129192
2021-02-27 10:54 wp Note Added: 0129195
2021-02-27 13:59 wp Note Edited: 0129195 View Revisions
2021-02-28 12:19 wp Note Added: 0129229
2021-03-07 16:01 wp Status assigned => resolved
2021-03-07 16:01 wp Resolution open => fixed
2021-03-07 16:01 wp LazTarget => -
2021-03-07 16:01 wp Widgetset Win32/Win64, QT5 => Win32/Win64, QT5
2021-03-07 16:01 wp Note Added: 0129485