Results 1 to 2 of 2

Thread: QNetworkAccessManager->get freezes when called in DLL

  1. #1
    Join Date
    Jun 2012

    Default QNetworkAccessManager->get freezes when called in DLL

    Hi. I have a dll where I want to do some networking, this dll is called from an C# application as an unmanaged DLL.
    All initialization works fine but it freezes everytime the ->get() is supposed to run. I have this code:

    QUrl path(remotePath);
    QNetworkRequest request(path);

    doCallback("failed to open: " + localPath);
    doCallback("before get: " + remotePath);
    QNetworkReply* reply = this->manager->get(request);
    doCallback("after get: " + localPath);

    The "before get" callback is executed fine but never the one "after get" so I guess it completely freezes when manager is trying the Get() method. Have I missed something or is this just plain impossible through an DLL?

  2. #2
    Join Date
    Oct 2009
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows

    Default Re: QNetworkAccessManager->get freezes when called in DLL

    It is unclear to me what is wrong precisely without being able to run some code, but there are a few things to consider:
    1. QNetworkManager requires a Qt event loop to be running to function properly. Is that the case in your DLL? (In any case this should not prevent get() from returning.)
    2. QNetworkManager may require QCoreApplication to be instanciated, although I could not find anything supporting that intuition in the docs.
    3. Are you certain that doCallback("before get: " + remotePath) returns? It might have time to print something and then freeze before returning.
    Can you reproduce the problem in a minimal example?

Similar Threads

  1. Replies: 4
    Last Post: 29th April 2011, 13:44
  2. Application freezes for 0.5 sec after keyPressEvent
    By Coolcat in forum Qt Programming
    Replies: 1
    Last Post: 21st April 2011, 12:16
  3. GUI freezes in loop: Thread does not help?
    By Matty23 in forum Qt Programming
    Replies: 4
    Last Post: 25th November 2010, 21:04
  4. QT-Phonon Immage freezes
    By ma.giorgio in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2010, 16:47
  5. Keyboards freezes
    By giusepped in forum Qt-based Software
    Replies: 0
    Last Post: 28th October 2008, 01:30

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.