summaryrefslogtreecommitdiff
path: root/objective-c
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-07-05 12:10:49 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-07-05 12:10:49 +0200
commite706fb2ceb23b1ee3c225f6d9569c58359b4ee72 (patch)
tree56d6d90d0a079d89ee7b2ab1c1013055cdca6e29 /objective-c
parentICE-8218 - Windows OpenSSL test build failure with parallel builds (diff)
downloadice-e706fb2ceb23b1ee3c225f6d9569c58359b4ee72.tar.bz2
ice-e706fb2ceb23b1ee3c225f6d9569c58359b4ee72.tar.xz
ice-e706fb2ceb23b1ee3c225f6d9569c58359b4ee72.zip
Fixed ICE-8217 - added ice_getSlicedData method to Ice values and Ice::SlicedData::clear method to break cyclic references
Diffstat (limited to 'objective-c')
-rw-r--r--objective-c/include/objc/Ice/Object.h1
-rw-r--r--objective-c/include/objc/Ice/SlicedData.h10
-rw-r--r--objective-c/src/Ice/Object.mm4
-rw-r--r--objective-c/src/Ice/SlicedData.mm10
-rw-r--r--objective-c/test/Ice/slicing/objects/AllTests.m6
5 files changed, 31 insertions, 0 deletions
diff --git a/objective-c/include/objc/Ice/Object.h b/objective-c/include/objc/Ice/Object.h
index 32fb0e134bd..bd21b6bc940 100644
--- a/objective-c/include/objc/Ice/Object.h
+++ b/objective-c/include/objc/Ice/Object.h
@@ -48,6 +48,7 @@ ICE_API @interface ICEObject : NSObject<ICEObject, NSCopying>
+(NSString*) ice_staticId;
-(void) ice_preMarshal;
-(void) ice_postUnmarshal;
+-(id<ICESlicedData>) ice_getSlicedData;
+(NSString*const*) iceStaticIds:(int*)count idIndex:(int*)idx;
-(void) iceWrite:(id<ICEOutputStream>)os;
-(void) iceRead:(id<ICEInputStream>)is;
diff --git a/objective-c/include/objc/Ice/SlicedData.h b/objective-c/include/objc/Ice/SlicedData.h
index 1dacba245c9..b5984caf659 100644
--- a/objective-c/include/objc/Ice/SlicedData.h
+++ b/objective-c/include/objc/Ice/SlicedData.h
@@ -11,9 +11,19 @@
#import <objc/Ice/Object.h>
+//
+// SlicedData holds the slices of unknown types.
+//
ICE_API @protocol ICESlicedData<NSObject>
+//
+// Clear the slices to break potential cyclic references.
+//
+-(void) clear;
@end
+//
+// Unknown sliced object holds instance of unknown type.
+//
ICE_API @interface ICEUnknownSlicedValue : ICEObject
{
@private
diff --git a/objective-c/src/Ice/Object.mm b/objective-c/src/Ice/Object.mm
index fb058a810b5..0b76097c5ac 100644
--- a/objective-c/src/Ice/Object.mm
+++ b/objective-c/src/Ice/Object.mm
@@ -333,6 +333,10 @@ static NSString* ICEObject_ids[1] =
-(void) ice_postUnmarshal
{
}
+-(id<ICESlicedData>) ice_getSlicedData
+{
+ return nil;
+}
-(BOOL) ice_isA:(NSString*)typeId current:(ICECurrent*)current
{
NSAssert(NO, @"ice_isA requires override");
diff --git a/objective-c/src/Ice/SlicedData.mm b/objective-c/src/Ice/SlicedData.mm
index f27f2bd8f3c..6173d2e5ced 100644
--- a/objective-c/src/Ice/SlicedData.mm
+++ b/objective-c/src/Ice/SlicedData.mm
@@ -37,6 +37,10 @@
return slicedData_;
}
+-(void) clear
+{
+ slicedData_->clear();
+}
@end
@implementation ICEUnknownSlicedValue
@@ -86,4 +90,10 @@
assert(!slicedData->slices.empty());
unknownTypeId_ = toNSString(slicedData->slices[0]->typeId);
}
+
+-(ICESlicedData*) ice_getSlicedData
+{
+ return [[slicedData_ retain] autorelease];
+}
+
@end
diff --git a/objective-c/test/Ice/slicing/objects/AllTests.m b/objective-c/test/Ice/slicing/objects/AllTests.m
index 3905cf9ed88..32d74d8212d 100644
--- a/objective-c/test/Ice/slicing/objects/AllTests.m
+++ b/objective-c/test/Ice/slicing/objects/AllTests.m
@@ -784,6 +784,7 @@ slicingObjectsAllTests(id<ICECommunicator> communicator)
test(![[test ice_getEncodingVersion] isEqual:ICEEncoding_1_0]);
test([o isKindOfClass:[ICEUnknownSlicedValue class]]);
test([[((ICEUnknownSlicedValue*)o) getUnknownTypeId] isEqualToString:@"::Test::SUnknown"]);
+ test([((ICEUnknownSlicedValue*)o) ice_getSlicedData] != nil);
[test checkSUnknown:o];
}
@catch(ICENoValueFactoryException*)
@@ -2106,8 +2107,13 @@ slicingObjectsAllTests(id<ICECommunicator> communicator)
[test checkPBSUnknown:p];
if(![[test ice_getEncodingVersion] isEqual:ICEEncoding_1_0])
{
+ test([p ice_getSlicedData] != nil);
[[test ice_encodingVersion:ICEEncoding_1_0] checkPBSUnknown:p];
}
+ else
+ {
+ test([p ice_getSlicedData] == nil);
+ }
}
@catch(ICEOperationNotExistException*)
{