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 colorOnDarkBackground = polygonItem->colorOnDarkBackground();
QColor colorOnLightBackground = polygonItem->colorOnLightBackground(); 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" mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "z-value"
, QString("%1").arg(polygonItem->strokesGroup()->zValue())); , QString("%1").arg(polygonItem->strokesGroup()->zValue()));
@ -1126,6 +1127,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
, "fill-on-dark-background", colorOnDarkBackground.name()); , "fill-on-dark-background", colorOnDarkBackground.name());
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri
, "fill-on-light-background", colorOnLightBackground.name()); , "fill-on-light-background", colorOnLightBackground.name());
qDebug() << "Attributes written";
groupHoldsInfo = true; groupHoldsInfo = true;
} }

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

Loading…
Cancel
Save