From 9956c5cbd9e1075b0227270cb4401663ef384f67 Mon Sep 17 00:00:00 2001 From: Julien STAUB Date: Wed, 5 Aug 2026 20:07:07 +0200 Subject: [PATCH 1/3] fix #202 center hole from previous outline not cleaned --- igramarea.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/igramarea.cpp b/igramarea.cpp index 9f05a970..eb1760c3 100644 --- a/igramarea.cpp +++ b/igramarea.cpp @@ -2148,6 +2148,11 @@ void IgramArea::loadOutlineFile(const QString &fileName){ m_innerP2 = m_center.m_p2; innerPcount = 2; } + else { + m_innerP1 = QPointF(0,0); + m_innerP2 = QPointF(0,0); + innerPcount = 0; + } const double filter = loadDoc["dft_filter_radius"].toDouble(); emit dftCenterFilter(filter); @@ -2209,9 +2214,18 @@ void IgramArea::loadOutlineFileOldV6(const QString &fileName){ m_innerP2 = m_center.m_p2; innerPcount = 2; } + else { + m_center = CircleOutline(QPointF(0,0),0); + m_innerP1 = QPointF(0,0); + m_innerP2 = QPointF(0,0); + innerPcount = 0; + } } else { - m_center.m_radius = 0; + m_center = CircleOutline(QPointF(0,0),0); + m_innerP1 = QPointF(0,0); + m_innerP2 = QPointF(0,0); + innerPcount = 0; } std::string line; From 578da16d647088a03cfae5b90cc185b445dfe2bc Mon Sep 17 00:00:00 2001 From: Julien STAUB Date: Wed, 5 Aug 2026 20:07:34 +0200 Subject: [PATCH 2/3] typo --- surfacemanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/surfacemanager.cpp b/surfacemanager.cpp index 228f2e35..917efdc6 100644 --- a/surfacemanager.cpp +++ b/surfacemanager.cpp @@ -3209,7 +3209,7 @@ void SurfaceManager::report(){ doc->addResource(QTextDocument::ImageResource, QUrl(pixStat), QVariant(pixStats.scaledToWidth(dlg.histoWidth * finalWidth, Qt::SmoothTransformation))); - imagesHtml.append("
Pixel Histogram and SLope error
"); } editor->setHtml(title + html +zerns + imagesHtml + tail); From a4c7deb580cb2cdf2363532df69f3d9885ca8ef3 Mon Sep 17 00:00:00 2001 From: Julien STAUB Date: Wed, 5 Aug 2026 20:15:34 +0200 Subject: [PATCH 3/3] safe region loading in Oln file. no duplication --- igramarea.cpp | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/igramarea.cpp b/igramarea.cpp index eb1760c3..be3ef1ba 100644 --- a/igramarea.cpp +++ b/igramarea.cpp @@ -2129,14 +2129,27 @@ void IgramArea::loadOutlineFile(const QString &fileName){ // an oln file at all (or some portions of the oln data get lost). Because of this I decided not to report any json parsing errors. QJsonDocument loadDoc(QJsonDocument::fromJson(saveData)); + // Reset region model + UI so loading is self-contained and never leaks old regions. + m_polygons.clear(); + m_regionEdit->clear(); + // outer QJsonObject outside = loadDoc["outside_outline"].toObject(); CircleOutline out(outside); m_outside = out; m_outside.translate(QPointF(-cropTotalDx, -cropTotalDy)); - m_OutterP1 = m_outside.m_p1; - m_OutterP2 = m_outside.m_p2; - outterPcount = 2; + if (m_outside.m_radius > 0) { + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; + outterPcount = 2; + } + else { + qWarning() << "OLN load warning:" << fileName + << "has no valid outside outline; clearing outside outline state."; + m_OutterP1 = QPointF(0,0); + m_OutterP2 = QPointF(0,0); + outterPcount = 0; + } // center/inner QJsonObject inside = loadDoc["inside_outline"].toObject(); @@ -2160,7 +2173,6 @@ void IgramArea::loadOutlineFile(const QString &fileName){ // mask polygons regions - m_polygons.clear(); QJsonArray jregions = loadDoc["regions"].toArray(); for (int i=0; i < jregions.size(); ++i) { QJsonArray jpoly = jregions[i].toArray(); @@ -2197,11 +2209,24 @@ void IgramArea::loadOutlineFileOldV6(const QString &fileName){ return; } + // Reset region model + UI so loading is self-contained and never leaks old regions. + m_polygons.clear(); + m_regionEdit->clear(); + m_outside = readCircle(file, -cropTotalDx, -cropTotalDy); - m_OutterP1 = m_outside.m_p1; - m_OutterP2 = m_outside.m_p2; - outterPcount = 2; + if (m_outside.m_radius > 0) { + m_OutterP1 = m_outside.m_p1; + m_OutterP2 = m_outside.m_p2; + outterPcount = 2; + } + else { + qWarning() << "OLN load warning:" << fileName + << "has no valid outside outline; clearing outside outline state."; + m_OutterP1 = QPointF(0,0); + m_OutterP2 = QPointF(0,0); + outterPcount = 0; + } CircleOutline sideLobe = readCircle(file); emit dftCenterFilter(sideLobe.m_radius); char b = file.peek(); @@ -2229,7 +2254,6 @@ void IgramArea::loadOutlineFileOldV6(const QString &fileName){ } std::string line; - m_polygons.clear(); while(std::getline(file, line)){ if (line == "Poly"){