mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-27 07:30:20 -05:00
#14192 Python: Fix duplicate discrete property legend on repeated category-name calls
RimColorLegendCollection::deleteColorLegend erased the default-legend map entry before looking the legend up, so findDefaultLegendForResult always returned null and the old legend was never removed from m_customColorLegends. Each set_discrete_property_category_names call for the same property left an orphaned legend behind and appended a new one. Look up the legend before erasing the map key, and guard against deleting a standard legend that may have been registered as a default.
This commit is contained in:
1 parent
ef815a79f8
commit
5a083331b0
2 files changed
+32
-2
No files matched your search
@@ -119,10 +119,11 @@ RimColorLegend* RimColorLegendCollection::createColorLegend( const QString& colo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegendCollection::deleteColorLegend( const RimCase* rimCase, const QString& resultName )
|
||||
{
|
||||
auto legend = findDefaultLegendForResult( rimCase, resultName );
|
||||
|
||||
m_defaultColorLegendNameForResult.erase( createLookupKey( rimCase, resultName ) );
|
||||
|
||||
auto legend = findDefaultLegendForResult( rimCase, resultName );
|
||||
if ( !legend ) return;
|
||||
if ( !legend || isStandardColorLegend( legend ) ) return;
|
||||
|
||||
m_customColorLegends.removeChild( legend );
|
||||
delete legend;
|
||||
|
||||
Reference in new issue
Block a user