kcms/landingpage: Fix crash with software renderer

how to crash before this commit:

1. run `kcmshell6 kcm_qtquicksettings`
2. set "Rendering Backend:" to "Software"
3. click "OK"
4. run `kcmshell6 kcm_landingpage` or `systemsettings`
This commit is contained in:
BZZZZ DZZZZ 2025-08-04 06:58:46 +00:00 committed by Vlad Zahorodnii
parent 225ac96507
commit b2e3e90080

View file

@ -195,15 +195,18 @@ void SoftwareSplitNode::preprocess()
if (m_first) {
const auto texture = m_first->texture();
const QSize textureSize = texture->textureSize();
const bool creatingNode = !m_firstNode;
if (!m_firstNode) {
if (creatingNode) {
m_firstNode = m_window->createImageNode();
m_firstNode->setFlag(OwnedByParent);
appendChildNode(m_firstNode);
}
m_firstNode->setTexture(texture);
m_firstNode->setRect(0, 0, m_rect.width() * 0.5, m_rect.height());
m_firstNode->setSourceRect(0, 0, textureSize.width() * 0.5, textureSize.height());
if (creatingNode) {
appendChildNode(m_firstNode);
}
if (QSGDynamicTexture *dynamicTexture = qobject_cast<QSGDynamicTexture *>(m_first->texture())) {
dynamicTexture->updateTexture();
@ -216,15 +219,18 @@ void SoftwareSplitNode::preprocess()
if (m_second) {
const QSGTexture *texture = m_second->texture();
const QSize textureSize = texture->textureSize();
const bool creatingNode = !m_secondNode;
if (!m_secondNode) {
if (creatingNode) {
m_secondNode = m_window->createImageNode();
m_secondNode->setFlag(OwnedByParent);
appendChildNode(m_secondNode);
}
m_secondNode->setTexture(m_second->texture());
m_secondNode->setRect(m_rect.width() * 0.5, 0, m_rect.width() * 0.5, m_rect.height());
m_secondNode->setSourceRect(textureSize.width() * 0.5, 0, textureSize.width() * 0.5, textureSize.height());
if (creatingNode) {
appendChildNode(m_secondNode);
}
if (QSGDynamicTexture *dynamicTexture = qobject_cast<QSGDynamicTexture *>(m_second->texture())) {
dynamicTexture->updateTexture();