[Interest] QPA plugin and crash in effectiveWinId()

Martin Koller kollix at aon.at
Sun Sep 29 18:51:03 CEST 2013


On Sunday 29 September 2013 15:20:09 Martin Koller wrote:
> Hi,
> 
> I'm currently implementing a QPA plugin for Qt-4.8.4.
> What I now see is a crash (ASSERT) in QWidget::effectiveWinId() as nativeParentWidget() returns 0.
> This is happening when I send mouse move events to Qt and the cursors leaves a widget:
> 
> #5  0x00007ffff6541555 in qt_assert (assertion=0x7ffff789f049 "realParent", file=
>     0x7ffff789ee50 "kernel/qwidget.cpp", line=2620) at global/qglobal.cpp:1996
> #6  0x00007ffff70f63f7 in QWidget::effectiveWinId (this=0x674f20) at kernel/qwidget.cpp:2620
> #7  0x00007ffff7138767 in qt_qpa_set_cursor (w=0x674f20, force=false) at kernel/qwidget_qpa.cpp:865
> #8  0x00007ffff713623b in QWidgetPrivate::unsetCursor_sys (this=0x6753c0) at kernel/qwidget_qpa.cpp:258
> #9  0x00007ffff70fb337 in QWidget::unsetCursor (this=0x674f20) at kernel/qwidget.cpp:5115
> #10 0x00007ffff75fb56e in QToolBar::event (this=0x674f20, event=0x7fffffffcb10) at widgets/qtoolbar.cpp:1183
> 
> 
> It's not clear to me if I'm doing something wrong or if it's a bug in Qt.
> 
> What do I need to do in my QPA plugin so that a widgets has a nativeParentWidget() ?

It seems I solved it now. Looking into the vnc plugin, I see that it just generates non-zero winIds
in a derived class of QPlatformWindow:
      static QAtomicInt winIdGenerator(1);
      windowId = winIdGenerator.fetchAndAddRelaxed(1);

and returns this in
virtual WId winId() const { return windowId; }

So I also implemented my own QPlatformWindow derived class.

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at



More information about the Interest mailing list