View Issue Details

IDProjectCategoryView StatusLast Update
0035577LazarusLCLpublic2019-05-13 14:57
ReporterZeljan RikaloAssigned ToZeljan Rikalo 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0035577: LCLTaskDialog: segfaults under win32 for qt,qt5
DescriptionActually TTaskDialog segfaults under win32 for non win32 wigetsets (qt,qt5).
TagsNo tags attached.
Fixed in Revision61219
LazTarget-
WidgetsetQT, QT5
Attached Files
  • taskdialogqtwindows.diff (3,250 bytes)
    Index: lcl/lcltaskdialog.pas
    ===================================================================
    --- lcl/lcltaskdialog.pas	(revision 61218)
    +++ lcl/lcltaskdialog.pas	(working copy)
    @@ -126,7 +126,7 @@
     {$MODE DELPHI}
     
     uses
    -  LCLType, LCLStrConsts, LCLIntf,
    +  LCLType, LCLStrConsts, LCLIntf, LCLPlatformDef, InterfaceBase,
       {$IFDEF MSWINDOWS}
       Windows, CommCtrl, Messages,
       {$ENDIF}
    @@ -803,6 +803,9 @@
           aParent := 0;
       Dialog.OnButtonClicked := aOnButtonClicked;
       {$ifdef MSWINDOWS}
    +  if (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
    +    // do not execute mswindows code
    +  else
       if Assigned(TaskDialogIndirect) and not aNonNative and
          not (tdfQuery in aFlags) and (Selection='') then begin
         Dialog.Emulated := False;
    @@ -887,11 +890,14 @@
           IconBorder := 10 else
           IconBorder := 24;
     
    -     if (LAZ_ICONS[aDialogIcon]<>'') {$IFDEF MSWINDOWS}or (WIN_ICONS[aDialogIcon]<>nil){$ENDIF} then
    +     if (LAZ_ICONS[aDialogIcon]<>'') {$IFDEF MSWINDOWS}or (not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) and (WIN_ICONS[aDialogIcon]<>nil)){$ENDIF} then
          begin
           Image := TImage.Create(Dialog.Form);
           Image.Parent := Par;
           {$IFDEF MSWINDOWS}
    +      if (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
    +        IconHandle := 0
    +      else
           if WIN_ICONS[aDialogIcon]<>nil then
             IconHandle := LoadIcon(0,WIN_ICONS[aDialogIcon])
           else
    @@ -1085,7 +1091,7 @@
           if XB<>0 then
             AddBevel else
             inc(Y,16);
    -      if (LAZ_FOOTERICONS[aFooterIcon]<>'') {$IFDEF MSWINDOWS}or (WIN_FOOTERICONS[aFooterIcon]<>nil){$ENDIF} then
    +      if (LAZ_FOOTERICONS[aFooterIcon]<>'') {$IFDEF MSWINDOWS}or (not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) and (WIN_FOOTERICONS[aFooterIcon]<>nil)){$ENDIF} then
           begin
             Image := TImage.Create(Dialog.Form);
             Image.Parent := Par;
    @@ -1095,7 +1101,7 @@
             try
               Bmp.Transparent := true;
               {$IFDEF MSWINDOWS}
    -          if WIN_FOOTERICONS[aFooterIcon]<>nil then
    +          if (WIN_FOOTERICONS[aFooterIcon]<>nil) and not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
               begin
                 IconHandle := LoadIcon(0,WIN_FOOTERICONS[aFooterIcon]);
                 if IconHandle<>0 then
    @@ -1125,8 +1131,9 @@
                 else
                 begin
                   {$IFDEF MSWINDOWS}
    -              DrawIconEx(Bmp.Canvas.Handle,0,0,Ico.Handle,Bmp.Width,Bmp.Height,0,
    -                Bmp.Canvas.Brush.{%H-}Handle,DI_NORMAL);
    +              if not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
    +                DrawIconEx(Bmp.Canvas.Handle,0,0,Ico.Handle,Bmp.Width,Bmp.Height,0,
    +                  Bmp.Canvas.Brush.{%H-}Handle,DI_NORMAL);
                   {$ENDIF}
                 end;
                 Image.Picture.Bitmap := Bmp;
    @@ -1191,8 +1198,11 @@
           Dialog.Form.Element[element].Caption := CR(Text)
         {$IFDEF MSWINDOWS}
         else
    -      SendMessageW(Dialog.Wnd,TDM_UPDATE_ELEMENT_TEXT,ord(element),
    -        {%H-}NativeInt(PWideChar(_WS(Text))))
    +    begin
    +      if not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
    +        SendMessageW(Dialog.Wnd,TDM_UPDATE_ELEMENT_TEXT,ord(element),
    +          {%H-}NativeInt(PWideChar(_WS(Text))))
    +    end
         {$ENDIF};
       tdeEdit:
         if Dialog.Emulated then
    
    taskdialogqtwindows.diff (3,250 bytes)

Activities

Zeljan Rikalo

2019-05-13 13:47

developer   ~0116161

Possible patch added

taskdialogqtwindows.diff (3,250 bytes)
Index: lcl/lcltaskdialog.pas
===================================================================
--- lcl/lcltaskdialog.pas	(revision 61218)
+++ lcl/lcltaskdialog.pas	(working copy)
@@ -126,7 +126,7 @@
 {$MODE DELPHI}
 
 uses
-  LCLType, LCLStrConsts, LCLIntf,
+  LCLType, LCLStrConsts, LCLIntf, LCLPlatformDef, InterfaceBase,
   {$IFDEF MSWINDOWS}
   Windows, CommCtrl, Messages,
   {$ENDIF}
@@ -803,6 +803,9 @@
       aParent := 0;
   Dialog.OnButtonClicked := aOnButtonClicked;
   {$ifdef MSWINDOWS}
+  if (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
+    // do not execute mswindows code
+  else
   if Assigned(TaskDialogIndirect) and not aNonNative and
      not (tdfQuery in aFlags) and (Selection='') then begin
     Dialog.Emulated := False;
@@ -887,11 +890,14 @@
       IconBorder := 10 else
       IconBorder := 24;
 
-     if (LAZ_ICONS[aDialogIcon]<>'') {$IFDEF MSWINDOWS}or (WIN_ICONS[aDialogIcon]<>nil){$ENDIF} then
+     if (LAZ_ICONS[aDialogIcon]<>'') {$IFDEF MSWINDOWS}or (not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) and (WIN_ICONS[aDialogIcon]<>nil)){$ENDIF} then
      begin
       Image := TImage.Create(Dialog.Form);
       Image.Parent := Par;
       {$IFDEF MSWINDOWS}
+      if (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
+        IconHandle := 0
+      else
       if WIN_ICONS[aDialogIcon]<>nil then
         IconHandle := LoadIcon(0,WIN_ICONS[aDialogIcon])
       else
@@ -1085,7 +1091,7 @@
       if XB<>0 then
         AddBevel else
         inc(Y,16);
-      if (LAZ_FOOTERICONS[aFooterIcon]<>'') {$IFDEF MSWINDOWS}or (WIN_FOOTERICONS[aFooterIcon]<>nil){$ENDIF} then
+      if (LAZ_FOOTERICONS[aFooterIcon]<>'') {$IFDEF MSWINDOWS}or (not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) and (WIN_FOOTERICONS[aFooterIcon]<>nil)){$ENDIF} then
       begin
         Image := TImage.Create(Dialog.Form);
         Image.Parent := Par;
@@ -1095,7 +1101,7 @@
         try
           Bmp.Transparent := true;
           {$IFDEF MSWINDOWS}
-          if WIN_FOOTERICONS[aFooterIcon]<>nil then
+          if (WIN_FOOTERICONS[aFooterIcon]<>nil) and not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
           begin
             IconHandle := LoadIcon(0,WIN_FOOTERICONS[aFooterIcon]);
             if IconHandle<>0 then
@@ -1125,8 +1131,9 @@
             else
             begin
               {$IFDEF MSWINDOWS}
-              DrawIconEx(Bmp.Canvas.Handle,0,0,Ico.Handle,Bmp.Width,Bmp.Height,0,
-                Bmp.Canvas.Brush.{%H-}Handle,DI_NORMAL);
+              if not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
+                DrawIconEx(Bmp.Canvas.Handle,0,0,Ico.Handle,Bmp.Width,Bmp.Height,0,
+                  Bmp.Canvas.Brush.{%H-}Handle,DI_NORMAL);
               {$ENDIF}
             end;
             Image.Picture.Bitmap := Bmp;
@@ -1191,8 +1198,11 @@
       Dialog.Form.Element[element].Caption := CR(Text)
     {$IFDEF MSWINDOWS}
     else
-      SendMessageW(Dialog.Wnd,TDM_UPDATE_ELEMENT_TEXT,ord(element),
-        {%H-}NativeInt(PWideChar(_WS(Text))))
+    begin
+      if not (WidgetSet.LCLPlatform in [lpQT, lpQt5]) then
+        SendMessageW(Dialog.Wnd,TDM_UPDATE_ELEMENT_TEXT,ord(element),
+          {%H-}NativeInt(PWideChar(_WS(Text))))
+    end
     {$ENDIF};
   tdeEdit:
     if Dialog.Emulated then
taskdialogqtwindows.diff (3,250 bytes)

Zeljan Rikalo

2019-05-13 14:54

developer   ~0116163

Changed title and explanation.

Zeljan Rikalo

2019-05-13 14:57

developer   ~0116164

Fixed, close after detailed testing ...

Issue History

Date Modified Username Field Change
2019-05-13 11:43 Zeljan Rikalo New Issue
2019-05-13 13:47 Zeljan Rikalo File Added: taskdialogqtwindows.diff
2019-05-13 13:47 Zeljan Rikalo Note Added: 0116161
2019-05-13 14:54 Zeljan Rikalo Summary LCLTaskDialog: icons are not visible under win32 for qt,qt5 => LCLTaskDialog: segfaults under win32 for qt,qt5
2019-05-13 14:54 Zeljan Rikalo Description Updated View Revisions
2019-05-13 14:54 Zeljan Rikalo LazTarget => -
2019-05-13 14:54 Zeljan Rikalo Widgetset QT, QT5 => QT, QT5
2019-05-13 14:54 Zeljan Rikalo Note Added: 0116163
2019-05-13 14:54 Zeljan Rikalo Assigned To => Zeljan Rikalo
2019-05-13 14:54 Zeljan Rikalo Status new => assigned
2019-05-13 14:57 Zeljan Rikalo Status assigned => resolved
2019-05-13 14:57 Zeljan Rikalo Resolution open => fixed
2019-05-13 14:57 Zeljan Rikalo Fixed in Revision => 61219
2019-05-13 14:57 Zeljan Rikalo Widgetset QT, QT5 => QT, QT5
2019-05-13 14:57 Zeljan Rikalo Note Added: 0116164