Re: CoreData - sqlite - statement is still active
Re: CoreData - sqlite - statement is still active
- Subject: Re: CoreData - sqlite - statement is still active
- From: Terrence Talbot <email@hidden>
- Date: Mon, 10 Oct 2005 11:04:47 -0700
On Oct 7, 2005, at 5:53 PM, Terrence Talbot wrote:
Ok, following up from off-line
conversations:email@hidden
This did turn out to be a threading problem. Although my code
wasn't intentionally touching the context outside of the default
thread, it turns out that WebKit was calling into my code, via
WebFrame's -loadRequest: method, from a different thread. That
sequence, in turn, caused the context to execute fetches in other
than the main thread. Blammo!
[snip]
My naive approach, which is actually working, is to have the the
context -lock and -unlock itself in the -
objectsWithEntityName:predicate:error method I included in a
previous post in this thread. (That method actually has a zombie
problem in that fetchedObjects is released before it's potentially
used in a log, so fix that if you use it.) I also have to override
valueForKey: in my managed object subclass and lock/unlock the
context there. That works. My app *doesn't* crash.
One last quick post on this:
Since it was actually a single, isolated case where WebKit was
calling back into my code and causing problems for the context, I was
able to boil it down to a couple of performSelectorOnMainThread:
calls and all is happy. I'm no longer overriding valueForKey: or
setting locks all over the place. Everything is working just fine. Go
CoreData!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden