Skip to content

Commit

Permalink
fix #269845 Svg don't inheirt QPaintEnginePrivate
Browse files Browse the repository at this point in the history
SvgPaintEnginePrivate class has always extended QPaintEnginePrivate.  But QPaintEnginePrivate was defined in a header file which was copy-and-pasted from Qt over 6 years ago in the initial git commit.  But with 5.10, Qt added another QRegion member to their definition of QPaintEnginePrivate to fix a bug, so the old copy-and-pasted header no longer correctly represents QPaintEnginePrivate.  This conflicting definition results in a segfault whenever I tried to run mscore 2.1, 2.2, or master at least on my armv7 arch linux machine when using Qt 5.10 (although worked with Qt 5.9).

Lasconic suggested maybe try removing the inheiritance all together.  Turns out SvgPaintEnginePrivate doesn't actually need to inheirit QPaintEnginePrivate.  So the fix here is to remove that inheiritance and complety remove the old copy-and-pasted private header file.
  • Loading branch information
Eric Fontaine authored and lasconic committed Feb 28, 2018
1 parent 84b414a commit 5507d25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 124 deletions.
120 changes: 0 additions & 120 deletions mscore/paintengine_p.h

This file was deleted.

8 changes: 4 additions & 4 deletions mscore/svggenerator.cpp
Expand Up @@ -40,7 +40,6 @@
****************************************************************************/

#include "svggenerator.h"
#include "paintengine_p.h"
#include "libmscore/mscore.h"

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -153,7 +152,7 @@ static QString getClass(const Ms::Element *e)
return eName;
}

class SvgPaintEnginePrivate : public QPaintEnginePrivate
class SvgPaintEnginePrivate
{
public:
SvgPaintEnginePrivate()
Expand Down Expand Up @@ -232,6 +231,7 @@ class SvgPaintEngine : public QPaintEngine
private:
QString stateString;
QTextStream stateStream;
SvgPaintEnginePrivate *d_ptr;

// Qt translates everything. These help avoid SVG transform="translate()".
qreal _dx;
Expand Down Expand Up @@ -312,10 +312,10 @@ class SvgPaintEngine : public QPaintEngine

public:
SvgPaintEngine()
: QPaintEngine(*new SvgPaintEnginePrivate,
svgEngineFeatures()),
: QPaintEngine(svgEngineFeatures()),
stateStream(&stateString)
{
d_ptr = new SvgPaintEnginePrivate;
}

bool begin(QPaintDevice *device);
Expand Down

0 comments on commit 5507d25

Please sign in to comment.