QtnRibbonTitleBarWidgetPrivate has a pointer to the RibbonBar.
I found that when closing the app it would crash with a problem in RibbonTitleBarWidget::topWidget() which was caused by the RibbonBar having been deleted already when another QEvent::WinIdChange came along.
I changed the naked pointer to a QPointer<RibbonBar> and then in the topWidget() method I checked if m_ribbonBar is non-zero first. Easy.
So, why do you use naked pointers to store references to your own stuff when it's so easy to add a bit of stability to your code by using QPointer<> and then testing whether the object is actually still there? You should only store a naked pointer if the object is *owned* and will be destroyed *before* the object that is pointing to it. In all other cases, use a QPointer<> if you can.
Same problem in RibbonToolBarActionGroupItem where you are storing a naked pointer to objects that are *not* owned by you, i.e. action and widget. Same fix as above to fix crashes in RibbonToolBarControlPrivate::calculateSizeHint and RibbonGalleryControl::sizeHint.