<table><tr><td style="">ahiemstra created this revision.<br />ahiemstra added a reviewer: Kirigami.<br />Herald added a project: Kirigami.<br />Herald added a subscriber: plasma-devel.<br />ahiemstra requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D27505">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>When Icon's width or height is 0, I get a crash with the following backtrace:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">#0 0x00007ffff7b9cd30 in QSGTexture::setFiltering(QSGTexture::Filtering) () from /usr/lib/libQt5Quick.so.5
#1 0x00007ffff7bd439c in QSGOpaqueTextureMaterialShader::updateState(QSGMaterialShader::RenderState const&, QSGMaterial*, QSGMaterial*) () from /usr/lib/libQt5Quick.so.5
#2 0x00007ffff7bb7857 in QSGBatchRenderer::Renderer::renderMergedBatch(QSGBatchRenderer::Batch const*) () from /usr/lib/libQt5Quick.so.5
#3 0x00007ffff7bbd5b6 in QSGBatchRenderer::Renderer::renderBatches() () from /usr/lib/libQt5Quick.so.5
#4 0x00007ffff7bbdcc5 in QSGBatchRenderer::Renderer::render() () from /usr/lib/libQt5Quick.so.5
#5 0x00007ffff7ba1832 in QSGRenderer::renderScene(QSGBindable const&) () from /usr/lib/libQt5Quick.so.5
#6 0x00007ffff7ba1d14 in QSGRenderer::renderScene(unsigned int) () from /usr/lib/libQt5Quick.so.5
#7 0x00007ffff7c10713 in QSGDefaultRenderContext::renderNextFrame(QSGRenderer*, unsigned int) () from /usr/lib/libQt5Quick.so.5
#8 0x00007ffff7c7b3a1 in QQuickWindowPrivate::renderSceneGraph(QSize const&, QSize const&) () from /usr/lib/libQt5Quick.so.5</pre></div>
<p>This patch prevents Icon from doing anything when width or height is 0, avoiding the crash.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>The following QML code, when ran through qmlscene, no longer crashes:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">import QtQuick 2.12
import org.kde.kirigami 2.11 as Kirigami
Item {
Kirigami.Icon { source: "document-new" }
}</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R169 Kirigami</div></div></div><br /><div><strong>BRANCH</strong><div><div>icon_crash</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D27505">https://phabricator.kde.org/D27505</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/icon.cpp</div></div></div><br /><div><strong>To: </strong>ahiemstra, Kirigami<br /><strong>Cc: </strong>plasma-devel, fbampaloukas, GB_2, domson, dkardarakos, ngraham, apol, ahiemstra, davidedmundson, mart, hein<br /></div>