Lazarus

Programming => LCL => Topic started by: CCRDude on April 16, 2021, 01:23:29 pm

Title: Broken file dialogs on Windows
Post by: CCRDude on April 16, 2021, 01:23:29 pm
I've got a project I compiled last year, Lazarus 2.1.0 rc62299, FPC 3.3.
Today I compiled, then updated laz/fpc trunk, now Lazarus 2.1.0 rc56006, FPC 3.3.1.

I use file dialogs in some places. TFileOpen action type, but sometimes directly, e.g. TSelectDirectoryDialog.

These dialogs have in common that in rc62299 they worked as expected, and in the past weeks, the process simply freezes instead of opening the requested system dialog.
Title: Re: Broken file dialogs on Windows
Post by: Bart on April 16, 2021, 03:46:06 pm
Is this inside the debugger, or outside?

Bart
Title: Re: Broken file dialogs on Windows
Post by: CCRDude on April 21, 2021, 12:49:01 pm
Both actually.

It simply freezes.

And I found the problem: I do use
Code: [Select]
CoInitializeEx(nil, COINIT_MULTITHREADED). Switching to
Code: [Select]
COINIT_APARTMENTTHREADED, dialogs work.

Previously, I think both worked. Anyway, with standard LCL controls, I didn't expect conflicts with my COM stuff.
Title: Re: Broken file dialogs on Windows
Post by: marcov on April 21, 2021, 12:55:12 pm
IFileDialog is a COM object.
Title: Re: Broken file dialogs on Windows
Post by: CCRDude on April 21, 2021, 03:00:14 pm
Thanks, that explains it!

Wouldn't it make sense to print a compiler warning about calls to CoInitializeEx with the wrong parameter if the LCL is included in the projects requirements?
Title: Re: Broken file dialogs on Windows
Post by: marcov on April 21, 2021, 04:19:26 pm
Thanks, that explains it!

Wouldn't it make sense to print a compiler warning about calls to CoInitializeEx with the wrong parameter if the LCL is included in the projects requirements?

I don't think so. Moreover, the compiler doesn't know what the LCL is.
TinyPortal © 2005-2018