Skip to content

Commit 29aee5d

Browse files
committed
GDALAlgorithm: fix invalid C++ use that caused crashed with gcc 14.2 / Alpine
1 parent c19543d commit 29aee5d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

gcore/gdalalgorithm.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ GDALAlgorithmArgDecl &GDALAlgorithmArgDecl::SetMaxCount(int count)
215215
return *this;
216216
}
217217

218+
/************************************************************************/
219+
/* GDALAlgorithmArg::~GDALAlgorithmArg() */
220+
/************************************************************************/
221+
222+
GDALAlgorithmArg::~GDALAlgorithmArg() = default;
223+
218224
/************************************************************************/
219225
/* GDALAlgorithmArg::Set() */
220226
/************************************************************************/
@@ -2146,7 +2152,7 @@ GDALAlgorithm::AddArg(std::unique_ptr<GDALInConstructionAlgorithmArg> arg)
21462152
}
21472153
m_args.emplace_back(std::move(arg));
21482154
return *(
2149-
static_cast<GDALInConstructionAlgorithmArg *>(m_args.back().get()));
2155+
cpl::down_cast<GDALInConstructionAlgorithmArg *>(m_args.back().get()));
21502156
}
21512157

21522158
GDALInConstructionAlgorithmArg &

gcore/gdalalgorithm.h

+3
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,9 @@ class CPL_DLL GDALAlgorithmArg /* non-final */
11611161
}
11621162
}
11631163

1164+
/** Destructor */
1165+
virtual ~GDALAlgorithmArg();
1166+
11641167
/** Return the argument declaration. */
11651168
const GDALAlgorithmArgDecl &GetDeclaration() const
11661169
{

0 commit comments

Comments
 (0)