Important: Please read the Qt Code of Conduct -

QLocalSocket issue

  • Hi all,

    I am working in a reasonably big project and I am facing with a weird problem. The story is long but I will keep it short. I can go more in detail if you guys need for more accurate answers.

    QLocalSocket *pSocket = new QLocalSocket;
    if (pSocket->waitForConnected(500))
    return (true);
    // Client socket can be discarded.
    delete (pSocket);
    return (false);

    When I run the application in Debug mode, the application gives Debug Error with the following message:

    @ASSERT failure in QWinEventNotifier::QWinEventNotifier():"Cannot create a win event notifier without a WEventDispatcherWin32", file kernel\qwineventnotifier_p.cpp line 74@

    The code stops at
    @QLocalSocket *pSocket = new QLocalSocket;@

    If I run it in Release mode, it just crashes.

    Here is a little bit more explanation: The same code part runs without any problem in another part of the project. I actually copied and pasted the function and assumed that it would work. The only difference that I could see for now is that the working part is running in a separate thread and the part that I am trying to implement is not in a separate thread. Do you think that the error is due to threading issue?

    Could you please guide me how to fix this?

    PS: I am running it on Windows7.

    Many thanks in advance,

  • Small update: Could this be because of caller class? The function which is called from the working part is in a class which is inherited from QObject but the function which is causing the problem is called in a class which has no derivation from QObject?

Log in to reply