mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4380 Preferences : Changing scene font size when geo mech view is open causes crash
Guard access to annotationCollection, as this is nullptr for geo mech views.
This commit is contained in:
@@ -2031,7 +2031,7 @@ void RiaApplication::applyPreferences(const RiaPreferences* oldPreferences)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RimGridView* gridView = dynamic_cast<RimGridView*>(rim3dView);
|
RimGridView* gridView = dynamic_cast<RimGridView*>(rim3dView);
|
||||||
if (gridView)
|
if (gridView && gridView->annotationCollection())
|
||||||
{
|
{
|
||||||
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultAnnotationFontSize();
|
RiaFontCache::FontSize oldFontSize = oldPreferences->defaultAnnotationFontSize();
|
||||||
existingObjectsWithCustomFonts = gridView->annotationCollection()->hasTextAnnotationsWithCustomFontSize(oldFontSize);
|
existingObjectsWithCustomFonts = gridView->annotationCollection()->hasTextAnnotationsWithCustomFontSize(oldFontSize);
|
||||||
|
|||||||
@@ -295,9 +295,12 @@ bool RimGridView::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType
|
|||||||
bool hasCustomFonts = Rim3dView::hasCustomFontSizes(fontSettingType, defaultFontSize);
|
bool hasCustomFonts = Rim3dView::hasCustomFontSizes(fontSettingType, defaultFontSize);
|
||||||
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
|
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
|
||||||
{
|
{
|
||||||
auto annotations = annotationCollection();
|
auto annotations = annotationCollection();
|
||||||
RiaFontCache::FontSize defaultFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(defaultFontSize);
|
if (annotations)
|
||||||
hasCustomFonts = annotations->hasTextAnnotationsWithCustomFontSize(defaultFontSizeEnum) || hasCustomFonts;
|
{
|
||||||
|
RiaFontCache::FontSize defaultFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(defaultFontSize);
|
||||||
|
hasCustomFonts = annotations->hasTextAnnotationsWithCustomFontSize(defaultFontSizeEnum) || hasCustomFonts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return hasCustomFonts;
|
return hasCustomFonts;
|
||||||
}
|
}
|
||||||
@@ -313,14 +316,18 @@ bool RimGridView::applyFontSize(RiaDefines::FontSettingType fontSettingType,
|
|||||||
bool anyChange = Rim3dView::applyFontSize(fontSettingType, oldFontSize, fontSize, forceChange);
|
bool anyChange = Rim3dView::applyFontSize(fontSettingType, oldFontSize, fontSize, forceChange);
|
||||||
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
|
if (fontSettingType == RiaDefines::ANNOTATION_FONT)
|
||||||
{
|
{
|
||||||
auto annotations = annotationCollection();
|
auto annotations = annotationCollection();
|
||||||
RiaFontCache::FontSize oldFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
|
if (annotations)
|
||||||
RiaFontCache::FontSize newFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(fontSize);
|
|
||||||
bool applyFontSizes = forceChange || !annotations->hasTextAnnotationsWithCustomFontSize(oldFontSizeEnum);
|
|
||||||
|
|
||||||
if (applyFontSizes)
|
|
||||||
{
|
{
|
||||||
anyChange = annotations->applyFontSizeToAllTextAnnotations(oldFontSizeEnum, newFontSizeEnum, forceChange) || anyChange;
|
RiaFontCache::FontSize oldFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(oldFontSize);
|
||||||
|
RiaFontCache::FontSize newFontSizeEnum = RiaFontCache::fontSizeEnumFromPointSize(fontSize);
|
||||||
|
bool applyFontSizes = forceChange || !annotations->hasTextAnnotationsWithCustomFontSize(oldFontSizeEnum);
|
||||||
|
|
||||||
|
if (applyFontSizes)
|
||||||
|
{
|
||||||
|
anyChange =
|
||||||
|
annotations->applyFontSizeToAllTextAnnotations(oldFontSizeEnum, newFontSizeEnum, forceChange) || anyChange;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return anyChange;
|
return anyChange;
|
||||||
|
|||||||
Reference in New Issue
Block a user