View Issue Details

IDProjectCategoryView StatusLast Update
0014794LazarusLCLpublic2009-10-18 12:04
ReporterJosé Mejuto Assigned ToPaul Ishenin  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWindows 
Product Version0.9.29 (SVN) 
Fixed in Version0.9.29 (SVN) 
Summary0014794: Open/Save dialog (Win32/64) with option ofOldStyleDialog crashes
DescriptionSummary says everything
Steps To ReproduceAdd a TOpenDialog to a form and in Option set to true "ofOldStyleDialog".
Additional InformationAttached patch solves the problem. It simply extract information from NotifyEvent for known events, not for everyone as some of them may not carry the expected information.

Also var section in function moved to use them in inner function procedure and avoid passing parameters.

Tested under WinXP SP2 and Vista x64.
TagsNo tags attached.
Fixed in Revision22215
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

2009-10-14 00:14

 

opensave_dialog_oldstyle.patch (1,879 bytes)   
Index: win32wsdialogs.pp
===================================================================
--- win32wsdialogs.pp	(revision 22155)
+++ win32wsdialogs.pp	(working copy)
@@ -423,6 +423,10 @@
 
 function OpenFileDialogCallBack(Wnd: HWND; uMsg: UINT; wParam: WPARAM;
   lParam: LPARAM): UINT; stdcall;
+var
+  OpenFileNotify: LPOFNOTIFY;
+  OpenFileName: Windows.POPENFILENAME;
+  DialogRec: POpenFileDialogRec;
 
   procedure Reposition(ADialogWnd: Handle);
   var
@@ -450,10 +454,13 @@
     SetWindowPos(ADialogWnd, HWND_TOP, Left, Top, 0, 0, SWP_NOSIZE);
   end;
 
-var
-  OpenFileNotify: LPOFNOTIFY;
-  OpenFileName: Windows.POPENFILENAME;
-  DialogRec: POpenFileDialogRec;
+  procedure ExtractDataFromNotify();
+  begin
+    OpenFileName := OpenFileNotify^.lpOFN;
+    DialogRec := POpenFileDialogRec(OpenFileName^.lCustData);
+    UpdateStorage(Wnd, OpenFileName);
+    UpdateFileProperties(OpenFileName);
+  end;
 begin
   if uMsg = WM_INITDIALOG then
   begin
@@ -468,20 +475,27 @@
     if OpenFileNotify = nil then
       Exit;
 
-    OpenFileName := OpenFileNotify^.lpOFN;
-    DialogRec := POpenFileDialogRec(OpenFileName^.lCustData);
-    UpdateStorage(Wnd, OpenFileName);
-    UpdateFileProperties(OpenFileName);
-
     case OpenFileNotify^.hdr.code of
       CDN_INITDONE:
+      begin
+        ExtractDataFromNotify();
         TOpenDialog(DialogRec^.Dialog).DoShow;
+      end;
       CDN_SELCHANGE:
+      begin
+        ExtractDataFromNotify();
         TOpenDialog(DialogRec^.Dialog).DoSelectionChange;
+      end;
       CDN_FOLDERCHANGE:
+      begin
+        ExtractDataFromNotify();
         TOpenDialog(DialogRec^.Dialog).DoFolderChange;
+      end;
       CDN_TYPECHANGE:
+      begin
+        ExtractDataFromNotify();
         DialogRec^.Dialog.IntfFileTypeChanged(OpenFileNotify^.lpOFN^.nFilterIndex);
+      end;
     end;
   end;
   Result := 0;
opensave_dialog_oldstyle.patch (1,879 bytes)   

Paul Ishenin

2009-10-18 08:34

manager   ~0031432

Thanks, applied with minor modifications.

Issue History

Date Modified Username Field Change
2009-10-14 00:14 José Mejuto New Issue
2009-10-14 00:14 José Mejuto File Added: opensave_dialog_oldstyle.patch
2009-10-14 00:14 José Mejuto Widgetset => Win32/Win64
2009-10-18 08:34 Paul Ishenin Fixed in Revision => 22215
2009-10-18 08:34 Paul Ishenin LazTarget => -
2009-10-18 08:34 Paul Ishenin Status new => resolved
2009-10-18 08:34 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2009-10-18 08:34 Paul Ishenin Resolution open => fixed
2009-10-18 08:34 Paul Ishenin Assigned To => Paul Ishenin
2009-10-18 08:34 Paul Ishenin Note Added: 0031432
2009-10-18 12:04 José Mejuto Status resolved => closed