uROClasses.UnRegisterEnumMappings kills all enum mappings in a namespace when any type is unregistered (e.g. a plugin unload)

Hello,

I have discovered that the UnRegisterEnumMappings function in the current RO version newly contains a code to remove the type list. Unfortunately the list is cleared even if only one type is unregistered. I believe the list should be removed only when it is empty.

See code in uROClasses.pas:

procedure UnRegisterEnumMappings(const aEnumName: string; aNamespace: string);
{$IFNDEF RO_RTTI_Support}
var
  i, j: Integer;
  l_list: TMyEnumMappingList;
  l_mapping: TROEnumMapping;
{$ENDIF}
begin
{$IFDEF RO_RTTI_Support}
  RORTTI_UnRegisterEnumMappings(aEnumName, aNamespace);
{$ELSE}
  j := g_enumRemapping.IndexOf(aNamespace);
  if j <> -1 then begin
    l_list := TMyEnumMappingList(g_enumRemapping.Objects[j]);
    if l_list <> nil then begin
      for i := l_list.Count - 1 downto 0 do
        if TROEnumMapping(l_list.Items[i]).EnumName = aEnumName then begin
          l_mapping := TROEnumMapping(l_list.Items[i]);
          FreeOrDisposeOfAndNil(l_mapping);
          l_list.Delete(i);
        end;
// <FIX>>>
//      l_list.Free; // we don't want to release list on every call
      if l_list.Count = 0 then
        l_list.Free // release list only if empty
      else
        Exit;
// <<<FIX>
    end;
    g_enumRemapping.Delete(j);
  end;
{$ENDIF}
end;

Regards, Jaroslav

Logged as bugs://D19397.

bugs://D19397 was closed as fixed.