r21854 by jghali - #14706: Modifying conical gradient stops may trigger crash
scribus-commit
scribus-commit at lists.scribus.net
Sun Mar 26 14:35:30 UTC 2017
Author: jghali
Date: Sun Mar 26 14:35:30 2017
New Revision: 21854
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21854
Log:
#14706: Modifying conical gradient stops may trigger crash
Modified:
trunk/Scribus/scribus/pageitem.cpp
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21854&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sun Mar 26 14:35:30 2017
@@ -3343,6 +3343,22 @@
double radius = angLin.length();
double radius2 = radius * 2.0;
QList<VColorStop*> rstops = gradient.colorStops();
+ if (rstops.count() < 2)
+ {
+ const VColorStop* firstStop = rstops.at(0);
+ if (firstStop->rampPoint > 0)
+ {
+ VColorStop* newStop = new VColorStop(*firstStop);
+ newStop->rampPoint = 0;
+ rstops.prepend(newStop);
+ }
+ if (firstStop->rampPoint < 1.0)
+ {
+ VColorStop* newStop = new VColorStop(*firstStop);
+ newStop->rampPoint = 1.0;
+ rstops.append(newStop);
+ }
+ }
double stepAngle = 360 * rstops.at(1)->rampPoint;
path.arcMoveTo(-radius, -radius, radius2, radius2, 0);
path.arcTo(-radius, -radius, radius2, radius2, 0, -stepAngle);
@@ -3397,6 +3413,8 @@
for (uint rst = 2; rst < gradient.Stops(); ++rst)
{
stepAngle = 360 * (rstops.at(rst)->rampPoint - rstops.at(rst-1)->rampPoint);
+ if (stepAngle <= 0)
+ continue;
path = QPainterPath();
arcPath.resize(0);
path.arcMoveTo(-radius, -radius, radius2, radius2, 0);
More information about the scribus-commit
mailing list