mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 20:26:03 +08:00
Fixed:
- access violation when initializing 0x0 matrices - exception can be thrown during stack unwind while comma-initializing a matrix if eigen_assert if configured to throw
This commit is contained in:
parent
cc954777f2
commit
96cd1ff718
@ -33,6 +33,8 @@ struct CommaInitializer
|
|||||||
inline CommaInitializer(XprType& xpr, const Scalar& s)
|
inline CommaInitializer(XprType& xpr, const Scalar& s)
|
||||||
: m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1)
|
: m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1)
|
||||||
{
|
{
|
||||||
|
eigen_assert(m_xpr.rows() > 0 && m_xpr.cols() > 0
|
||||||
|
&& "Cannot comma-initialize a 0x0 matrix (operator<<)");
|
||||||
m_xpr.coeffRef(0,0) = s;
|
m_xpr.coeffRef(0,0) = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +43,8 @@ struct CommaInitializer
|
|||||||
inline CommaInitializer(XprType& xpr, const DenseBase<OtherDerived>& other)
|
inline CommaInitializer(XprType& xpr, const DenseBase<OtherDerived>& other)
|
||||||
: m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
|
: m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
|
||||||
{
|
{
|
||||||
|
eigen_assert(m_xpr.rows() > 0 && m_xpr.cols() > 0
|
||||||
|
&& "Cannot comma-initialize a 0x0 matrix (operator<<)");
|
||||||
m_xpr.block(0, 0, other.rows(), other.cols()) = other;
|
m_xpr.block(0, 0, other.rows(), other.cols()) = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +107,6 @@ struct CommaInitializer
|
|||||||
EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception)
|
EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns the built matrix once all its coefficients have been set.
|
/** \returns the built matrix once all its coefficients have been set.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user