[Interest] Crash when creating QNetworkAccessManager in qt 5.14.x

Henry Skoglund henry at tungware.se
Wed Feb 5 17:06:46 CET 2020


On 2020-02-05 16:32, maitai wrote:
>
> Hi Rainer,
>
> Unfortunately your suggestion didn't work
>
> I have added in my pro file:
>
> win32:QMAKE_LFLAGS+=/CLRTHREADATTRIBUTE:MTA
> and I can see the option in the link command (I also tried the 2 other possibilities STA and NONE of course), but that does not fix anything.
>
> My feeling is that it does not come fromCoInitializeEx() finally, because anyway in regular builds we are 
> calling it at the very beginning of main, before creating QApplication 
> or QNetworkManager, so the threading model should be already determined.
>
Hi, I've seen similar discussions re. COM threading model and Qt, mostly 
though they are about QFileDialog and not QNetworkManager, anyways one 
solution seems to be to call CoUninitialize when switching the threading 
model, more for example here: 
https://stackoverflow.com/questions/46581081/qt-qfiledialog-create-unknown-com-object-and-security

P.S. Also that linker switch /CLRTHREADATTRIBUTE:MTA isn't that mostly 
for .NET programs?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200205/c7bc7e98/attachment.html>


More information about the Interest mailing list