mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
Address review feedback on crash-fix batch
- Camera::fitView/computeFitViewEyePosition: derive one corrected, non-parallel up vector and use it consistently for right, upNorm, planeTop and the final setFromLookAt(), instead of only repairing the right vector. Previously the degenerate (parallel dir/up) case still produced a singular view matrix because up itself was never corrected. Added a regression test exercising fitView() end-to-end (not just computeFitViewEyePosition()) that checks the resulting direction/up/right form a valid orthonormal basis. - RimViewController::updateCameraLink/updateTimeStepLink: guard against ownerViewLinker()->masterView() being null (RimViewLinker::setMasterView(nullptr) is a supported state), not only against a null view linker. - RicHistogramPlotTools: use RiaGuiApplication::isRunning() before calling RiaGuiApplication::instance(), since instance() itself asserts when there is no running GUI application. - RimDockWindowController::updateViewerWidget: create the view widget before the dock widget, so a failed view-widget creation does not leave a dock widget allocated without a dock manager (which deleteDockWidget() cannot clean up). - RimStimPlanModelCalculator::calculateFormation: avoid continue via a small lambda, and reject double values outside the range of int before the static_cast to avoid undefined behavior.
This commit is contained in:
1 parent
5a9d38d53b
commit
63eaa1266d
6 files changed
+123
-31
No files matched your search
@@ -770,20 +770,24 @@ std::pair<std::vector<double>, std::vector<QString>> RimStimPlanModelCalculator:
|
||||
RimEclipseCase* eclipseCase = m_stimPlanModel->eclipseCaseForProperty( RiaDefines::CurveProperty::FACIES );
|
||||
std::vector<QString> formationNamesVector = RimWellLogTrack::formationNamesVector( eclipseCase );
|
||||
|
||||
auto formationNameForValue = [&formationNamesVector]( double value ) -> QString
|
||||
{
|
||||
if ( !RiaCurveDataTools::isValidValue( value, false ) ) return "_";
|
||||
|
||||
// Reject values outside the range of int before casting to avoid undefined behavior.
|
||||
if ( value < static_cast<double>( std::numeric_limits<int>::min() ) || value > static_cast<double>( std::numeric_limits<int>::max() ) )
|
||||
return "_";
|
||||
|
||||
int idx = static_cast<int>( value );
|
||||
if ( idx >= 0 && idx < static_cast<int>( formationNamesVector.size() ) ) return formationNamesVector[idx];
|
||||
|
||||
return "_";
|
||||
};
|
||||
|
||||
std::vector<QString> formationNames;
|
||||
for ( auto value : values )
|
||||
{
|
||||
if ( !RiaCurveDataTools::isValidValue( value, false ) )
|
||||
{
|
||||
formationNames.push_back( "_" );
|
||||
continue;
|
||||
}
|
||||
|
||||
int idx = static_cast<int>( value );
|
||||
if ( idx >= 0 && idx < static_cast<int>( formationNamesVector.size() ) )
|
||||
formationNames.push_back( formationNamesVector[idx] );
|
||||
else
|
||||
formationNames.push_back( "_" );
|
||||
formationNames.push_back( formationNameForValue( value ) );
|
||||
}
|
||||
|
||||
return std::make_pair( values, formationNames );
|
||||
|
||||
Reference in new issue
Block a user