From df079c9056aa25ffed08e0f4b7c8bdd89dcd8f9f Mon Sep 17 00:00:00 2001 From: "markummitchell@gmail.com" Date: Mon, 8 Jul 2019 15:41:11 -0700 Subject: [PATCH] Restore changes from old branch --- contrib/python/ParseDig.py | 22 ++++++++-------------- src/Dlg/DlgEditPointAxis.h | 12 ++++++------ src/Dlg/DlgEditPointGraph.h | 12 ++++++------ src/Point/PointStyle.cpp | 7 ++++++- src/Tutorial/TutorialButton.cpp | 8 +++++--- src/main/MainWindow.cpp | 1 + 6 files changed, 32 insertions(+), 30 deletions(-) diff --git a/contrib/python/ParseDig.py b/contrib/python/ParseDig.py index c87654f4..9bf30390 100644 --- a/contrib/python/ParseDig.py +++ b/contrib/python/ParseDig.py @@ -62,19 +62,12 @@ def callEngauge (argumentsArray, debug = False): debugArgs = ['-debug'] fullArgs = [engaugeExecutable] + debugArgs + argumentsArray - useShell = False - if useShell: - # Linux has a bug where using shell requires arguments to be joined or else only first is seen - p = subprocess.Popen (' '.join (fullArgs), - stdin = subprocess.PIPE, - stdout = subprocess.PIPE, - stderr = subprocess.PIPE, - shell = True) - else: - p = subprocess.Popen (fullArgs, - stdin = subprocess.PIPE, - stdout = subprocess.PIPE, - stderr = subprocess.PIPE) + # Linux has a bug where using shell requires arguments to be joined or else only first is seen. So if shell=True + # is added then first argument becomes ' '.join (fullArgs) + p = subprocess.Popen (fullArgs, + stdin = subprocess.PIPE, + stdout = subprocess.PIPE, + stderr = subprocess.PIPE) out, err = p.communicate () preturncode = p.returncode if preturncode == -SIGSEGV: @@ -246,7 +239,8 @@ def parseXml(self, tree): self.LogPlot = True #sys.exit (1) elif (node.tag == 'Export'): - delimiterEnum = node.attrib.get('Delimiter') + # delimiterEnum = node.attrib.get('Delimiter') + pass elif (node.tag == 'Curve'): curveName = node.attrib.get('CurveName') if (curveName == 'Axes'): diff --git a/src/Dlg/DlgEditPointAxis.h b/src/Dlg/DlgEditPointAxis.h index c4d58d8c..5a5f670c 100644 --- a/src/Dlg/DlgEditPointAxis.h +++ b/src/Dlg/DlgEditPointAxis.h @@ -8,15 +8,15 @@ #define DLG_EDIT_POINT_AXIS_H #include "DocumentAxesPointsRequired.h" +#include "DocumentModelCoords.h" +#include "DocumentModelGeneral.h" +#include "MainWindowModel.h" #include #include #include class DlgValidatorAbstract; -class DocumentModelCoords; -class DocumentModelGeneral; class MainWindow; -class MainWindowModel; class QVBoxLayout; class Transformation; @@ -70,9 +70,9 @@ private slots: DocumentAxesPointsRequired m_documentAxesPointsRequired; - const DocumentModelCoords &m_modelCoords; - const DocumentModelGeneral &m_modelGeneral; - const MainWindowModel &m_modelMainWindow; + const DocumentModelCoords m_modelCoords; + const DocumentModelGeneral m_modelGeneral; + const MainWindowModel m_modelMainWindow; }; #endif // DLG_EDIT_POINT_AXIS_H diff --git a/src/Dlg/DlgEditPointGraph.h b/src/Dlg/DlgEditPointGraph.h index 359af040..c6c2a81a 100644 --- a/src/Dlg/DlgEditPointGraph.h +++ b/src/Dlg/DlgEditPointGraph.h @@ -7,16 +7,16 @@ #ifndef DLG_EDIT_POINT_GRAPH_H #define DLG_EDIT_POINT_GRAPH_H +#include "DocumentModelCoords.h" +#include "DocumentModelGeneral.h" +#include "MainWindowModel.h" #include #include #include class DlgEditPointGraphLineEdit; class DlgValidatorAbstract; -class DocumentModelCoords; -class DocumentModelGeneral; class MainWindow; -class MainWindowModel; class QPushButton; class QVBoxLayout; class Transformation; @@ -69,9 +69,9 @@ private slots: // Enable Ok button once text has changed. For simplicity, this is true even when original text is restored bool m_changed; - const DocumentModelCoords &m_modelCoords; - const DocumentModelGeneral &m_modelGeneral; - const MainWindowModel &m_modelMainWindow; + const DocumentModelCoords m_modelCoords; + const DocumentModelGeneral m_modelGeneral; + const MainWindowModel m_modelMainWindow; }; #endif // DLG_EDIT_POINT_GRAPH_H diff --git a/src/Point/PointStyle.cpp b/src/Point/PointStyle.cpp index 9779f462..3a59e984 100644 --- a/src/Point/PointStyle.cpp +++ b/src/Point/PointStyle.cpp @@ -26,7 +26,12 @@ const PointShape DEFAULT_POINT_SHAPE_AXIS = POINT_SHAPE_CROSS; const double PI = 3.1415926535; const double TWO_PI = 2.0 * PI; -PointStyle::PointStyle () +PointStyle::PointStyle () : + // Defaults that prevent address sanitizer warnings. Overwritten immediately + m_shape (DEFAULT_POINT_SHAPE_AXIS), + m_radius (DEFAULT_POINT_RADIUS), + m_lineWidth (DEFAULT_POINT_LINE_WIDTH), + m_paletteColor (DEFAULT_POINT_COLOR_GRAPH) { } diff --git a/src/Tutorial/TutorialButton.cpp b/src/Tutorial/TutorialButton.cpp index 8e011cc7..de5e04d9 100644 --- a/src/Tutorial/TutorialButton.cpp +++ b/src/Tutorial/TutorialButton.cpp @@ -29,10 +29,12 @@ TutorialButton::TutorialButton (const QString &text, TutorialButton::~TutorialButton () { - QGraphicsScene *scene = m_rect->scene(); - scene->removeItem (m_rect); // This also removes m_text from the scene + if (m_rect != nullptr) { + QGraphicsScene *scene = m_rect->scene(); + scene->removeItem (m_rect); // This also removes m_text from the scene - delete m_rect; + delete m_rect; + } delete m_text; } diff --git a/src/main/MainWindow.cpp b/src/main/MainWindow.cpp index d3920892..19f9fb7f 100644 --- a/src/main/MainWindow.cpp +++ b/src/main/MainWindow.cpp @@ -142,6 +142,7 @@ MainWindow::MainWindow(const QString &errorReportFile, const QStringList &commandLineWithoutLoadStartupFiles, QWidget *parent) : QMainWindow(parent), + m_originalFileWasImported (false), m_isDocumentExported (false), m_engaugeFile (EMPTY_FILENAME), m_currentFile (EMPTY_FILENAME),