diff --git a/Source/BoldCoreConsts.pas b/Source/BoldCoreConsts.pas index 4729e72..c1fe8b6 100644 --- a/Source/BoldCoreConsts.pas +++ b/Source/BoldCoreConsts.pas @@ -362,7 +362,9 @@ interface // BoldSystem sReasonUnknown = 'Reason unknown'; sFailureMessage = '%s.%s failed: %s'; + sObjectFromAnotherSystem = '%s Objects from wrong system passed to %s.'; sBoldObjectAssigned = '%s.Destroy: BoldObject assigned'; + sLocatorNotFound = '%s.%s. Locator not found for ID: %s'; sNoSuchClass = '%s.%s: System contains no class named: %s'; sCannotCreateInexact = 'Can not create objects with approximate type. ID: %s Class: %s'; sClassDoesNotBelongHere = '%s.GetAllInClass: %s does not belong to this system'; diff --git a/Source/BoldSystem.pas b/Source/BoldSystem.pas index bea62e1..869d77b 100644 --- a/Source/BoldSystem.pas +++ b/Source/BoldSystem.pas @@ -2541,6 +2541,12 @@ procedure TBoldSystem.UpdateDatabaseWithList(ObjectList: TBoldObjectList); begin if IsUpdatingDatabase then raise EBold.CreateFmt(sUpdateDbRentry, []); + if BoldSystemCount > 1 then + begin + for var BO in ObjectList do + if BO.BoldSystem <> self then + raise EBold.CreateFmt(sObjectFromAnotherSystem, [classname, 'UpdateDatabaseWithList']); + end; SystemPersistenceHandler.UpdateDatabaseWithList(ObjectList); if (DirtyObjects.Count > 0) then fOldValueHandler.PurgeEqualValues @@ -9898,16 +9904,21 @@ procedure TBoldSystem_Proxy.ApplytranslationList( var I: Integer; Locator: TBoldObjectLocator; + Id: TBoldObjectId; begin if IdTranslationList.Count = 0 then exit; for I := 0 to IdTranslationList.Count - 1 do begin - if Assigned(IdTranslationList.OldIDs[I]) then + Id := IdTranslationList.OldIDs[I]; + if Assigned(Id) then begin - Locator := ProxedSystem.Locators.LocatorByID[IdTranslationList.OldIDs[I]]; - if Assigned(IdTranslationList.NewIDs[I]) then - ProxedSystem.Locators.UpdateId(Locator, IdTranslationList.NewIds[i]) + Locator := ProxedSystem.Locators.LocatorByID[Id]; + if not Assigned(Locator) then + raise EBoldInternal.CreateFmt(sLocatorNotFound, [ClassName, 'ApplytranslationList', Id.AsString]); + Id := IdTranslationList.NewIDs[I]; + if Assigned(Id) then + ProxedSystem.Locators.UpdateId(Locator, Id) end else begin