Fixed crash upon saving a pen stroke with an uninitialized strokesGroup

preferencesAboutTextFull
Craig Watson 9 years ago
parent 26e0d76b7f
commit 871e7535e9
  1. 4
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 3
      src/domain/UBGraphicsPolygonItem.cpp

@ -1116,8 +1116,9 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
{
QColor colorOnDarkBackground = polygonItem->colorOnDarkBackground();
QColor colorOnLightBackground = polygonItem->colorOnLightBackground();
UBGraphicsStrokesGroup * sg = polygonItem->strokesGroup();
if (colorOnDarkBackground.isValid() && colorOnLightBackground.isValid())
if (colorOnDarkBackground.isValid() && colorOnLightBackground.isValid() && sg)
{
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "z-value"
, QString("%1").arg(polygonItem->strokesGroup()->zValue()));
@ -1126,6 +1127,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
, "fill-on-dark-background", colorOnDarkBackground.name());
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri
, "fill-on-light-background", colorOnLightBackground.name());
qDebug() << "Attributes written";
groupHoldsInfo = true;
}

@ -40,6 +40,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (QGraphicsItem * parent)
, mOriginalWidth(-1)
, mIsNominalLine(false)
, mStroke(0)
, mpGroup(NULL)
{
// NOOP
initialize();
@ -64,6 +65,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth)
, mOriginalWidth(pWidth)
, mIsNominalLine(true)
, mStroke(0)
, mpGroup(NULL)
{
// NOOP
initialize();
@ -75,6 +77,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pStartW
, mOriginalWidth(pEndWidth)
, mIsNominalLine(true)
, mStroke(0)
, mpGroup(NULL)
{
// NOOP
initialize();

Loading…
Cancel
Save