Threads, Distributed Objects, and NSUndoManager
Threads, Distributed Objects, and NSUndoManager
- Subject: Threads, Distributed Objects, and NSUndoManager
- From: "John C. Daub" <email@hidden>
- Date: Sat, 16 Oct 2004 14:40:54 -0500
Hello.
I have been unsuccessfully searching for information on how to work with
NSUndoManager and distributed objects.
In my application I do some work and record the work done in an object. I
then am able to push that object onto the NSUndoManager stack, and that
allows me to have undo/redo support. It all worked fine, before I refactored
it. :-)
Now I have refactored my application a bit so that while the work is going
on I display a progress sheet with progress bar and Stop button. To do this,
I had to put my work into a thread. But from what I was reading about
threads, since I'm going to need to have the thread collect my data then
pass the data back to the main thread, I need to use something like
distributed objects to pass that data back. I found Robert Harder's
ThreadWorker code and opted to use that.
So what happens is my application in the main thread allocates my "data
recording object" then create/starts the ThreadWorker and passes my data
object into the ThreadWorker. The ThreadWorker does the work, records the
data, then in its final callback passes back my data recording object. Since
I know my thread is done working, I figured that would be the right place
for me to take my data recording object, as given to me by the ThreadWorker,
and then add it to the NSUndoManager stack.
But that doesn't seem to work. My guess is because the data object I'm
actually given isn't the real data object but instead an NSProxy version of
the object... or at least that's what I see as I look at it in the debugger.
And I read that the default runloop doesn't allow me to record such objects
in my NSUndoManager. And that makes sense to not record such objects. But
then, how do I record my data for undoing?
So....
The main issue I'm wanting to figure out is of course how do I go about
accomplishing what I wish to accomplish. Maybe I need a totally different
approach.
But on the same token, maybe I'm doing something fundamentally wrong. I've
never used distributed objects before, nor NSUndoManager, so I could
certainly be making a novice mistake.
In order to do my thread work, including the way I pass the data around,
MUST I use DO and/or ThreadWorker? If I must, how can I get back at my
actual data object and not this NSProxy version of it? Or is there a way to
be able to record proxy objects for undoing?
Seeking enlightenment.... :-)
--
John C. Daub }:-)>=
<
mailto:email@hidden> <
http://www.hsoi.com/>
"If we moved next door to you, your lawn would die." -Lemmy Kilmister
_______________________________________________
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