To be more specific, problem occurs only in very specific circumstances. It’s in situation, when application is compiled as console-app and it’s compiled on Mac OS X version older than 10.9:
CONFIG -= gui CONFIG -= console
and when you’re using QEventLoop::exec in mode processing all events except user events (QEventLoop::ExcludeUserInputEvents):
//it's only demonstration, not full code... QNetworkAccessManager manager; ... QNetworkRequest request; ... QNetworkReply *reply = manager->post(request,arData); ... eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
In this situation, application hangs-up. When the application is compiled with GUI mode or when application is compiled on Linux/Windows (no matter if gui or console), everything works find. To fix this problem, it’s necessary to implement hack similar to this (simplified version):
bool bAllowUserInputEvents = false; #if defined(PLATFORM_MACOS) && defined(AX_APP_CONSOLE) bAllowUserInputEvents = true; #endif if ( bAllowUserInputEvents == false ) eventLoop.exec(QEventLoop::ExcludeUserInputEvents); else eventLoop.exec(QEventLoop::AllEvents);
Leave a Reply