[sword-svn] r3268 - trunk/bindings/objc/src
mdbergmann at crosswire.org
mdbergmann at crosswire.org
Thu Oct 9 02:23:05 MST 2014
Author: mdbergmann
Date: 2014-10-09 02:23:05 -0700 (Thu, 09 Oct 2014)
New Revision: 3268
Modified:
trunk/bindings/objc/src/SwordBible.mm
trunk/bindings/objc/src/SwordKey.mm
trunk/bindings/objc/src/SwordListKey.mm
trunk/bindings/objc/src/SwordModule.mm
trunk/bindings/objc/src/SwordVerseKey.mm
Log:
fix for crashes when releasing/deleting keys. (perist: true vs. false)
Modified: trunk/bindings/objc/src/SwordBible.mm
===================================================================
--- trunk/bindings/objc/src/SwordBible.mm 2014-10-08 19:43:28 UTC (rev 3267)
+++ trunk/bindings/objc/src/SwordBible.mm 2014-10-09 09:23:05 UTC (rev 3268)
@@ -426,7 +426,6 @@
SwordListKey *lk = [SwordListKey listKeyWithRef:aReference v11n:[self versification]];
[lk setPosition:SWPOS_TOP];
- [lk setPersist:NO];
SwordVerseKey *vk = [SwordVerseKey verseKeyWithRef:[lk keyText] v11n:[self versification]];
while(![lk error]) {
// set current key to vk
Modified: trunk/bindings/objc/src/SwordKey.mm
===================================================================
--- trunk/bindings/objc/src/SwordKey.mm 2014-10-08 19:43:28 UTC (rev 3267)
+++ trunk/bindings/objc/src/SwordKey.mm 2014-10-09 09:23:05 UTC (rev 3268)
@@ -40,17 +40,17 @@
if(self) {
if(copy) {
if(aSk) {
- sk = aSk->clone();
+ sk = aSk->clone();
+ sk->setPersist(true);
created = YES;
} else {
created = NO;
}
- [self setPersist:YES];
} else {
sk = aSk;
created = NO;
}
- }
+ }
return self;
}
Modified: trunk/bindings/objc/src/SwordListKey.mm
===================================================================
--- trunk/bindings/objc/src/SwordListKey.mm 2014-10-08 19:43:28 UTC (rev 3267)
+++ trunk/bindings/objc/src/SwordListKey.mm 2014-10-09 09:23:05 UTC (rev 3268)
@@ -58,6 +58,8 @@
}
sword::ListKey listKey = vk.parseVerseList([aRef UTF8String], "gen", true);
sword::ListKey *lk = new sword::ListKey(listKey);
+ lk->setPersist(true);
+
return (SwordListKey *) [super initWithSWKey:lk];
}
Modified: trunk/bindings/objc/src/SwordModule.mm
===================================================================
--- trunk/bindings/objc/src/SwordModule.mm 2014-10-08 19:43:28 UTC (rev 3267)
+++ trunk/bindings/objc/src/SwordModule.mm 2014-10-09 09:23:05 UTC (rev 3268)
@@ -483,6 +483,7 @@
}
- (void)setSwordKey:(SwordKey *)aKey {
+ swModule->getKey()->setPersist(true);
swModule->setKey([aKey swKey]);
}
Modified: trunk/bindings/objc/src/SwordVerseKey.mm
===================================================================
--- trunk/bindings/objc/src/SwordVerseKey.mm 2014-10-08 19:43:28 UTC (rev 3267)
+++ trunk/bindings/objc/src/SwordVerseKey.mm 2014-10-09 09:23:05 UTC (rev 3268)
@@ -60,11 +60,10 @@
}
- (SwordVerseKey *)initWithRef:(NSString *)aRef v11n:(NSString *)scheme {
- sword::VerseKey *vk = new sword::VerseKey();
- self = [super initWithSWKey:vk];
+ sword::VerseKey vk;
+ self = [super initWithSWKey:&vk makeCopy:YES];
if(self) {
created = YES;
- [self setPersist:YES];
if(scheme) {
[self setVersification:scheme];
}
More information about the sword-cvs
mailing list