summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/svg/qsvgstyle.cpp2
-rw-r--r--tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/svg/qsvgstyle.cpp b/src/svg/qsvgstyle.cpp
index 4385291..662692b 100644
--- a/src/svg/qsvgstyle.cpp
+++ b/src/svg/qsvgstyle.cpp
@@ -937,7 +937,7 @@ void QSvgGradientStyle::resolveStops()
{
if (!m_link.isEmpty() && m_doc) {
QSvgStyleProperty *prop = m_doc->styleProperty(m_link);
- if (prop) {
+ if (prop && prop != this) {
if (prop->type() == QSvgStyleProperty::GRADIENT) {
QSvgGradientStyle *st =
static_cast<QSvgGradientStyle*>(prop);
diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
index 2aa2225..8487d54 100644
--- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
+++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp
@@ -620,6 +620,15 @@ void tst_QSvgRenderer::gradientRefs()
"<linearGradient id=\"gradient\" xlink:href=\"#gradient0\">"
"</linearGradient>"
"</defs>"
+ "</svg>",
+ "<svg>"
+ "<defs>"
+ "<linearGradient xlink:href=\"#0\" id=\"0\">"
+ "<stop offset=\"0\" stop-color=\"red\" stop-opacity=\"0\"/>"
+ "<stop offset=\"1\" stop-color=\"blue\"/>"
+ "</linearGradient>"
+ "</defs>"
+ "<rect fill=\"url(#0)\" height=\"8\" width=\"256\" x=\"0\" y=\"0\"/>"
"</svg>"
};
for (size_t i = 0 ; i < sizeof(svgs) / sizeof(svgs[0]) ; ++i)