[Qt-interest] Q_ASSERT error/bug in qt_win_display_dc()?

Joshua Senecal jgsenecal at yahoo.com
Fri Sep 11 16:32:17 CEST 2009


Hi All,

I'm encountering the following error when debugging some code:

Q_ASSERT(qApp && qApp->thread() == QThread::currentThread());

This happens when attempting to draw some text. I don't see why this 
Assert is in there, as it doesn't make much sense to me.

According to the Qt Task Tracker (tag # 231157) this is (was) to be 
fixed in version 4.5.0. I have version 4.5.0, and it's definitely still 
there:

Q_GUI_EXPORT HDC qt_win_display_dc()                  // get display DC
{
    Q_ASSERT(qApp && qApp->thread() == QThread::currentThread());
    if (!displayDC)
        displayDC = GetDC(0);
    return displayDC;
} 

Is anyone else encountering this problem? Short of commenting out the 
Assert and recompiling Qt, is there a workaround? I'm guessing not, but 
thought I'd ask.

Thanks!

-Josh



More information about the Qt-interest-old mailing list