kcms/decoration: Fix crash when preview cannot be generated
m_bridge->createDecoration() can return nullptr. Most codepaths already guard against that, but not all of them BUG: 456531
This commit is contained in:
parent
6a4a68dea4
commit
0fef229587
1 changed files with 12 additions and 8 deletions
|
@ -41,7 +41,9 @@ PreviewItem::PreviewItem(QQuickItem *parent)
|
|||
|
||||
PreviewItem::~PreviewItem()
|
||||
{
|
||||
m_decoration->deleteLater();
|
||||
if (m_decoration) {
|
||||
m_decoration->deleteLater();
|
||||
}
|
||||
if (m_bridge) {
|
||||
m_bridge->unregisterPreviewItem(this);
|
||||
}
|
||||
|
@ -288,15 +290,17 @@ static QHoverEvent cloneEventWithPadding(QHoverEvent *event, int paddingLeft, in
|
|||
event->modifiers());
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
template<typename E>
|
||||
void PreviewItem::proxyPassEvent(E *event) const
|
||||
{
|
||||
const auto &shadow = m_decoration->shadow();
|
||||
if (shadow) {
|
||||
E e = cloneEventWithPadding(event, shadow->paddingLeft(), shadow->paddingTop());
|
||||
QCoreApplication::instance()->sendEvent(decoration(), &e);
|
||||
} else {
|
||||
QCoreApplication::instance()->sendEvent(decoration(), event);
|
||||
if (m_decoration) {
|
||||
const auto &shadow = m_decoration->shadow();
|
||||
if (shadow) {
|
||||
E e = cloneEventWithPadding(event, shadow->paddingLeft(), shadow->paddingTop());
|
||||
QCoreApplication::instance()->sendEvent(decoration(), &e);
|
||||
} else {
|
||||
QCoreApplication::instance()->sendEvent(decoration(), event);
|
||||
}
|
||||
}
|
||||
// Propagate events to parent
|
||||
event->ignore();
|
||||
|
|
Loading…
Reference in a new issue