plist parsing failure when using NSKeyedUnachiver
plist parsing failure when using NSKeyedUnachiver
- Subject: plist parsing failure when using NSKeyedUnachiver
- From: "Stefan Johansson" <email@hidden>
- Date: Fri, 22 Aug 2003 11:58:17 +0200
- Keywords: disclaimer
- Thread-topic: NSOutlineView drag hilight problem
Hi all,
I'm having a bit of a problem here.
What I have is two processes communication with each other through a
domain socket.
They communicate by sending NSMutableDictionary which have been serialized
with NSKeyedArchiver.
On the other end, they are de-serialized with NSKeyedUnarchiver.
Sends and receives are synchronized, so there is no cross writing to
socket going on.
The problem:
Process 1 is sending data to Process 2:
...populate NSMutableDictionary dict with values...
NSData *data=[NSKeyedArchiver archivedDataWithRootObject:dict];
write [data getBytes] to domain socket with write()
Process 2 recieves data and does:
read() into byte buffer
NSMutableDictionary *dict=[NSKeyedUnarchiver
unarchiveObjectWith
Data:[NSdata dataWithBytes:buffer lenght:length]];
However, if I do this repetitively and very fast (like many times per
second), the NSKeyedUnarchiver sometimes breaks with the following log
message:
CFLog (0):
CFPropertyListCreateFromXMLData(): plist parse failed; the data is
not proper UTF-8. The
file name for this data could be:
Resources/Info.plist --
file://localhost/System/Library/Frameworks/Foundation.framework/
The parser will retry as in 10.1, but the problem should be
corrected in the plist.
and the crash log:
Thread 5 Crashed:
#0 0x90165558 in __CFFromUTF8
#1 0x901ac8cc in __CFStringDecodeByteStream3
#2 0x901abdcc in __CFStringCreateImmutableFunnel3
Why is this?
Process 2 uses NSKeyedUnarchiver in a thread safe fashion (i.e one recieve
thread which handles incoming data synchronously).
The only thing would be Process 1, where NSKeyedArchiver is called upon by
many threads simultaneously.
Also the write() call in Process 1 in surrounded by a lock, so only one
thread can write to the socket at any given time.
The socket send and recieve implementations have been used in production
for about 2 years now, so there is nothing wrong there.
I have also noticed that the file path which CFLog gives as file name
above varies among any plist file which has anything to do with the
program (i.e loaded for reading at some point)
Isn't NSKeyedArchiver thread safe? Maybe if it isn't, the archived data
sent is corrupted and that's why Process 2 borks?
Any ideas?
Thanks,
Stefan
>
-----Original Message-----
>
From: Christopher Corbell [mailto:email@hidden]
>
Sent: den 22 augusti 2003 01:21
>
To: email@hidden
>
Subject: NSOutlineView drag hilight problem
>
>
>
I have an application object that can be dropped onto objects
>
in an NSOutlineView. All is working well, except that during the
>
drag NSOutlineView sometimes draws a drop hilight around the
>
targeted item (as a rectangle) and sometimes draws an "insertion"
>
hilight, as if the drop would insert something between rows.
>
>
This insertion hilight can leave 'ghost' hilights during the
>
drag which
>
look bad, and in any case this type of hilight doesn't mean anything
>
in this context (the dropped item is an operation that is applied to
>
the target item(s), it never causes insertion of an element).
>
>
Is it possible to defeat 'insertion'-type hilighting between
>
rows in an
>
NSOutlineView for a particular type of drag? The drag in question's
>
drag-operation type is NSDragOperationGeneric, and its pasteboard
>
type is a custom app-defined type.
>
>
Thanks for any suggestions,
>
- Christopher
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
>
This message has been scanned by F-Secure Anti-Virus for Microsoft
Exchange.
Confidentiality Notice:
The information contained in this message may be legally privileged and/or
confidential information. It is intended only for the recipient(s) named
above.
If the reader of this message is not an intended recipient, you are hereby
notified that any use, dissemination, distribution or copying of this
message is strictly prohibited.
If you have received this message in error, please notify us immediately
at once by
mailto:email@hidden and delete the original message.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.