Save dialogue hangs in XE2

769 views Asked by At

I use Delphi XE2 on Windows 8. I have ported an D2009 application to XE2 and suddenly the save dialog (TSaveDialog) is very slow.

When Project/Options/Application/Runtime Themes is set to Enable Runtime Themes:

=>

When I open the save dialog the window freezes for about a minute (sometimes I can close the window but have to wait about a minute until I can open the dialog again (or another TOpenDialog). The new Vista style save dialog is shown.

If I try to run this exe on a PC with Windows 7, the app hangs upon start (I did also try with XP compatibility mode without success).

When Project/Options/Application/Runtime Themes set to none:

=>

Save dialog works well (fast) but the old style dialog is shown, se example below:

Example old style dialog

This exe works well on a PC with Windows 7 (though with the old style dialog).

Ps. My old exe-file compiled with D2009 on a Win 7 PC works however well on both the Win 7 and 8 PC:s, and shows the dialogs correctly using the new Vista dialog style.

Could it be some permission rights in Win 8/7 causing this? I use IDE FIX PACK 5.4,

Thanks, Thomas

1

There are 1 answers

0
Thomas On BEST ANSWER

I found what the problem is. I use {$MAXSTACKSIZE $4000000} and this causes the save dialogue to freeze for about a minute. The reason for this hefty stack size is that I use a recursive algorithm (that I now probably need to remake).

Reproduce as follows (XE2):

  1. Create a new VCL forms application
  2. Place a TSaveDialog1 on the form
  3. Place a Tbutton with OnClick event

`

Begin
   if SaveDialog1.Execute then    
     MessageDlg('ok', mtInformation,[mbOk], 0);
end;

`

4: Open the project source file and put the following rows:

//{$MAXSTACKSIZE $3500000} //this is a decimal value of 5 5574 528 OK!

{$MAXSTACKSIZE $4000000} //this is a decimal value of 6 7108 864 Not OK!

Run and click the button. Give a dummy file name and press save. Nothing happens. Keep on clicking the button for 60 seconds. The dialogue will finally close.

Change to the smaller stack size $3500000. Now the program works well. Thanks for all tips.