PDA

View Full Version : QCoreApplication::postEvent: Unexpected null receiver



merlvingian
8th February 2007, 19:06
I am working with a QWorkspace and getting debug messages of QCoreApplication::postEvent: Unexpected null receiver on the console.

I cannot find an entry for "Unexpected null receiver" and am guessing that it has to do with the widget that was added to the workspace no longer being available to accept postEvents.

After preforming the following steps I will receive the postEvent message:
1. workspace->addWindow()

2. call show() on the widget

(At this point if I close the window resize it or manipulate it in any way OTHER then maximizing it I will not receive the message if I were to close the window and restart at step 1)

3. Through the UI call maximize() and then restore (showNormal) to restore the window size and position to its previous state before maximize.

4. close() the window through the UI.

(At this point if you start back at step 1 you will receive the messages as soon as show() is called)

The widget added is a Singleton (same result with new() widgets) and I still have access to it so I am not sure what is causing these messages. It seems to have no bearing on the program as it still functions as designed, but would like to correct whatever is causing this output.

The code is dependent on many other widgets so posting a code sample would take some time to trim it down to a small working example, so figured I would start with the question before investing the time needed to trim it.

Tested on XP OpenSource 4.2.2; Any clarity on the situation or error would be much appreciated.

edit: Will also receive this message twice on final close of the program.
edit2: Only produces the message after a restore from a maximized window. A minimized window then restore will not produce the message.

wysota
1st March 2007, 14:03
Did you manage to solve the problem?

Life is a Bug
12th March 2007, 23:26
I am having the exact same Problem also on XP QT 4.2.2 OpenSource.
Anyone knows a solution to this issue or what i might be doing wrong?

Kumosan
13th March 2007, 00:26
I am having the exact same Problem also on XP QT 4.2.2 OpenSource.
Anyone knows a solution to this issue or what i might be doing wrong?

You probably use either one of below methods directly or indirectly and *receiver is a 0 pointer.

QCoreApplication::postEvent ( QObject * receiver, QEvent * event )
QCoreApplication::sendEvent ( QObject * receiver, QEvent * event )

Kumosan
13th March 2007, 00:35
I am working with a QWorkspace and getting debug messages of QCoreApplication::postEvent: Unexpected null receiver on the console.

I cannot find an entry for "Unexpected null receiver" and am guessing that it has to do with the widget that was added to the workspace no longer being available to accept postEvents.


I am not sure. You definitely get this message when you pass a zero pointer for receiver in postEvent. If you pass a non-zero pointer of a no longer existing workspace, I'd expect much uglier things.

You really don't call postEvent somewhere directly?

merlvingian
13th March 2007, 17:18
Sorry I never gave the follow up on the issue so here is what I found.

Using 4.2.2 with WinXp Sp2 if you compile the Mainwindow -> MDI demo (example) with CONFIG += console you will get the same error results under the same test criteria.

I have not tested it under 4.2.3 so not sure of the results. I can extrapolate the meaning of the error but was a concern that I could not find it in the documentation. I myself do not enjoy writing docs and understand how development takes precedence over docs most of the time so no hard feelings.

At this point in time I am just ignoring it since it seems to have no ill affects but I do dislike seeing the messages ;)

Kumosan
13th March 2007, 21:25
I think you can ignore this message, though I know how disturbing unwanted warnings on the console can be.

I had the same warning once when during program start one object already posted an event to another object, which did not exist at that time. Of course I removed this sloppyness, but while it was present I have not seen any negative side effects either.