From: <sr...@us...> - 2006-07-22 05:32:55
|
Revision: 688 Author: srmitch Date: 2006-07-21 22:32:46 -0700 (Fri, 21 Jul 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=688&view=rev Log Message: ----------- - Update to throw a more useful EInstantAccessError rather than an AV when trying to access the members of an object that has been disposed before being fetched by an InstantQuery. Related to [bug# 1516101 ] "Problem disposing an TInstantObject with multiple queries". Modified Paths: -------------- trunk/Source/Core/InstantConsts.pas trunk/Source/Core/InstantPersistence.pas Modified: trunk/Source/Core/InstantConsts.pas =================================================================== --- trunk/Source/Core/InstantConsts.pas 2006-07-20 00:56:59 UTC (rev 687) +++ trunk/Source/Core/InstantConsts.pas 2006-07-22 05:32:46 UTC (rev 688) @@ -148,6 +148,7 @@ SObjectClassUndefined = 'ObjectClass undefined'; SObjectError = 'Error for object of class %s: "%s"'; SObjectIsOwned = 'Object %s(''%s'') is owned.'; + SObjectNotAvailable = 'Object is not available!'; SOwnershipRecursion = 'Ownership Recursion for object %s(''%s'')'; SPersistentObjectNotAllowed = 'Persistent object %s(''%s'') not allowed.'; SProtocolNotSupported = 'Protocol ''%s'' not supported'; Modified: trunk/Source/Core/InstantPersistence.pas =================================================================== --- trunk/Source/Core/InstantPersistence.pas 2006-07-20 00:56:59 UTC (rev 687) +++ trunk/Source/Core/InstantPersistence.pas 2006-07-22 05:32:46 UTC (rev 688) @@ -10658,6 +10658,10 @@ function TInstantQuery.GetObjects(Index: Integer): TObject; begin Result := InternalGetObjects(Index); + if not Assigned(Result) then + raise EInstantAccessError.CreateFmt(SErrorRetrievingObject, + [ObjectClassName, 'Query.Object[' + IntToStr(Index) + ']', + SObjectNotAvailable]); end; function TInstantQuery.GetParams: TParams; |