Skip to content

Commit 6565da6

Browse files
committed
Fix of multicolumn CSV observer early delete segfault
(fetch from remote repository)
1 parent 0e74aa5 commit 6565da6

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CMake.in.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SET(OFBUILD_CUSTOM_CMAKE_VERSION "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.
2323
SET(OPENFLUID_VERSION_MAJOR 2)
2424
SET(OPENFLUID_VERSION_MINOR 2)
2525
SET(OPENFLUID_VERSION_PATCH 1)
26-
SET(OPENFLUID_VERSION_STATUS "alpha3") # example: SET(OPENFLUID_VERSION_STATUS "rc1")
26+
SET(OPENFLUID_VERSION_STATUS "alpha4") # example: SET(OPENFLUID_VERSION_STATUS "rc1")
2727

2828
SET(OPENFLUID_VERSION_FULL "${OPENFLUID_VERSION_MAJOR}.${OPENFLUID_VERSION_MINOR}.${OPENFLUID_VERSION_PATCH}")
2929

src/observers/export.vars.files.csv-multicols/src/WareMain.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class CSVMultiColFilesObserver : public CSVFilesObserverBase
8585

8686
bool m_KeepNA;
8787

88+
bool m_FilesInitialized = false;
89+
8890

8991
public:
9092

@@ -288,7 +290,8 @@ class CSVMultiColFilesObserver : public CSVFilesObserverBase
288290
SetFiles.second.File = new BaseCSVFile();
289291
SetFiles.second.ColumnsHeaders = ColumnsHeaders;
290292
}
291-
293+
294+
m_FilesInitialized = true;
292295

293296
for (auto& SetFiles : m_SetsFiles)
294297
{
@@ -368,12 +371,15 @@ class CSVMultiColFilesObserver : public CSVFilesObserverBase
368371

369372
void onFinalizedRun()
370373
{
371-
for (auto& SetFiles : m_SetsFiles)
374+
if (m_FilesInitialized)
372375
{
373-
if(SetFiles.second.File)
376+
for (auto& SetFiles : m_SetsFiles)
374377
{
375-
delete SetFiles.second.File;
376-
SetFiles.second.File = 0; // avoid double delete issues
378+
if(SetFiles.second.File)
379+
{
380+
delete SetFiles.second.File;
381+
SetFiles.second.File = 0; // avoid double delete issues
382+
}
377383
}
378384
}
379385
}

0 commit comments

Comments
 (0)