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

Henry Skoglund henry at tungware.se
Thu Feb 6 12:01:20 CET 2020


Hmm perhaps one way forward is to move some COM-related code to a new 
thread (which is then untarnished by any prior CoInitialize(xxx), either 
your QNetworkAccessManager instance or the code somewhere in your 
HEADER/SOURCES that causes the crash (in concert with 5.14.1's 
QNetworkAccessManager).

On 2020-02-06 11:35, maitai wrote:
> Good idea, and I just tried. Unfortunately it still crashes...
>
> Philippe.
>
> Le 06-02-2020 11:21, Henry Skoglund a écrit :
>> Hi, also since constructing a QNetworkAccessManager() does a
>> CoInitialize(nullptr), have you tried doing a CoUninitialize() just
>> before, e.g;
>> ...
>> QApplication app(argc, argv);
>> CoUninitialize();
>> QNetworkAccessManager *inet = new QNetworkAccessManager();
>> delete inet;
>> ...
>>
>> On 2020-02-06 08:02, coroberti . wrote:
>>> Have you tried to comment out cleanup of reply objects 
>>> (QNetworkReply) ?
>>>
>>>
>>> On Thu, Feb 6, 2020 at 8:49 AM maitai <maitai at virtual-winds.org> wrote:
>>>> I've checked it already, and anyway a QFileDialog is a QWidget and 
>>>> as such cannot be created before QApplication (that's what it said 
>>>> when I tried).
>>>>
>>>> Philippe
>>>>
>>>>
>>>>
>>>>
>>>> Le 05-02-2020 21:20, Henry Skoglund a écrit :
>>>>
>>>> Hi, maybe you already checked this, but if you have any big wheels 
>>>> like a QFileDialog declared static, their ctors most likely will 
>>>> run before main(), i.e. some COM/networking activity could occur 
>>>> before main() kicks in.
>>>>
>>>> On 2020-02-05 21:10, maitai wrote:
>>>>
>>>> As I said, I now have doubts it comes from COM threading...
>>>>
>>>> I have built a small app with nothing inside, with the same .pro 
>>>> file exactly (qt modules, libs, etc, in the same order). The only 
>>>> difference is HEADERS and SOURCES of course, main.cpp being the 
>>>> same at least until it crashes. No problem in this small app 
>>>> (running in the same directory).
>>>>
>>>> Again for those who missed it:
>>>>
>>>> main.cpp:
>>>>
>>>>      QNetworkAccessManager *inet = new QNetworkAccessManager();
>>>>
>>>>      delete inet;
>>>>
>>>>      QApplication app(argc, argv);
>>>>
>>>> this works.
>>>>
>>>>     QApplication app(argc, argv);
>>>>
>>>>     QNetworkAccessManager *inet = new QNetworkAccessManager();
>>>>
>>>>      delete inet;
>>>>
>>>> this crashes on new in our app, not in a sample without HEADERS and 
>>>> SOURCES.
>>>>
>>>> I cannot understand that, certainly there is something obvious I am 
>>>> missing.



More information about the Interest mailing list