Important: Please read the Qt Code of Conduct -

ASSERT failure in QMutex::lock caused by copy to clipboard

  • I added a simple button to my application that would copy some text to the clipboard.

    If i press that button while using a debug build of my application (invoked from qtcreator), then when I close it down normally I get the following written to the Application Output a bunch of times.

    Invalid parameter passed to C runtime function.
    ASSERT failure in QMutex::lock: "Internal error, infinite wait has timed out.", file thread/qmutex.cpp, line 452
    Invalid parameter passed to C runtime function.

    Additionally another part of the application does something similar, calling QPlainTextEdit.copy(), and if I execute that code, the same thing error text is output.

    Is there something I'm doing wrong here?

  • Do you unlock mutex after doing requested operation?

  • No, I did not explicitly unlock mutex. I don't see anywhere in the documentation for "QClipboard":, or "QPlainTextEdit::copy()": where it says this is necessary.

    Maybe it is necessary, though if thats the case it seems like an oversight in the documentation...

  • Hi!
    I'm having a very similar problem (perhaps even the same). I have a qtextedit, and when I copy the content using Ctrl+C and the shutdown the application I end up with the same assertions. You can work around this by clearing the clipboard when the application shuts down, but whats the correct way?
    BR, Ulf.

Log in to reply