Jane1234567 / sqlitepersistentobjects

Automatically exported from code.google.com/p/sqlitepersistentobjects
0 stars 0 forks source link

Seem to get an infinite loop error when loading objects using code in rev 34. #23

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. NSArray * lastUsedArr = [UserPreference findByPrefKey:@"lastUsedX"];
2. The UserPreference object is a simple name/value pairing 

What is the expected output? What do you see instead?

Should load the object if available or get nil.  Instead, I get this exception:

BAD_ACCESS exception.

#0 0x95e158cf in CFAllocatorAllocate
#1 0x95e9560d in __CFStrAllocateMutableContents
#2 0x95e98c25 in __CFStringChangeSizeMultiple
#3 0x95ea2027 in CFStringAppend
#4 0x95ea2d63 in _CFStringAppendFormatAndArgumentsAux
#5 0x95ea44c8 in _CFStringCreateWithFormatAndArgumentsAux
#6 0x940d92e6 in -[NSPlaceholderString initWithFormat:locale:arguments:]
#7 0x940d9278 in +[NSString stringWithFormat:]
#8 0x00004ceb in -[NSString(UppercaseFirst) stringByLowercasingFirstLetter]
at NSString-UppercaseFirst.m:35
#9 0x0000ae99 in +[SQLitePersistentObject resolveClassMethod:] at
SQLitePersistentObject.m:845
#10 0x947c001e in _class_resolveMethod
#11 0x0000af3c in +[SQLitePersistentObject resolveClassMethod:] at
SQLitePersistentObject.m:856
#12 0x947c001e in _class_resolveMethod
#13 0x0000af3c in +[SQLitePersistentObject resolveClassMethod:] at
SQLitePersistentObject.m:856
#14 0x947c001e in _class_resolveMethod

snip

#58172 0x947c001e in _class_resolveMethod
#58173 0x0000af3c in +[SQLitePersistentObject resolveClassMethod:] at
SQLitePersistentObject.m:856
#58174 0x947c001e in _class_resolveMethod
#58175 0x947c02d5 in _class_lookupMethodAndLoadCache
#58176 0x947d06d6 in objc_msgSend
#58177 0x00004138 in -[FirstViewController viewDidLoad] at
FirstViewController.m:322
#58178 0x30c1e66e in -[UINib
instantiateWithOptions:owner:loadingResourcesFromBundle:]
#58179 0x30c204b8 in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:]

What version of the product are you using? On what operating system?

rev 34, iphone SDK, under simular.

Please provide any additional information below.

I have reverted to the earlier revision of sqlitePOs for now - that works fine.

Original issue reported on code.google.com by kimptoc on 19 Dec 2008 at 1:16

GoogleCodeExporter commented 8 years ago
I have tracked this down to the SQLitePersistentObject method: 

  + (BOOL)resolveClassMethod:(SEL)theMethod

It seems to call itself when it calls this line:

  if(class_getClassMethod([self class], newMethodSelector) != NULL) {

Although I cannot see any change in this method between the 2 versions 
directly, so I
guess its a problem in an unrelated bit of code... will have to look into this 
deeper

Original comment by kimptoc on 21 Dec 2008 at 10:46

GoogleCodeExporter commented 8 years ago
Attached is a tweak to the console test demonstrating the problem, using this 
method
call:

    posts = [Post findByTitle:@"Test post 1"];

Original comment by kimptoc on 23 Dec 2008 at 8:03

Attachments:

GoogleCodeExporter commented 8 years ago
Further to my comment above, it seems the resolveClassMethod call to [self 
class]
results in a call to resolveClassMethod, and thus the infinite loop...  this was
added in revision 30.  It seems to relate to the cocotron changes, but its in 
deeper
than my objective-c understands...

Original comment by kimptoc on 9 Jan 2009 at 9:52