The error message is a direct consequence of your application freezing. The wm window manager passes user-input events to its clients. If the wm client does not collect the events in the Qt event loop before the server-local queue is full, the server emits this warning and resets the queue. This way, a temporarily stuck client could later pick-up the most recent events addressing its windows.
Unfortunately, I don’t have any idea, why your application freezes outside the Qt event loop.