converting HTML causes crash
converting HTML causes crash
- Subject: converting HTML causes crash
- From: Rod Schmidt <email@hidden>
- Date: Fri, 13 Jun 2008 17:22:33 -0600
I'm trying to convert some HTML to an attributed string to display in
a text view. The conversion takes place fine using NSAtrributedString
initWithData:..., but later on I get an EXC_BAD_ACCESS. Here's the
stack trace where it usually happens (sometimes its different):
#0 0x911546e8 in objc_msgSend
#1 0x9331aed9 in _NSValuesAreEqual
#2 0x9335eb02 in -[NSTableBinder _updateSelectionIndexes:]
#3 0x9335e18f in -[NSTableBinder
_observeValueForKeyPath:ofObject:context:]
#4 0x9335de89 in -[NSTableBinder
observeValueForKeyPath:ofObject:change:context:]
#5 0x95ab40ce in NSKVONotify
#6 0x95a447d5 in -[NSObject(NSKeyValueObservingPrivate)
_notifyObserversForKeyPath:change:]
#7 0x9313ce92 in -[NSController _notifyObserversForKeyPath:change:]
#8 0x9313cd93 in -[NSController didChangeValueForKey:]
#9 0x93358e22 in -[NSArrayController
didChangeValuesForArrangedKeys:objectKeys:indexKeys:]
#10 0x933592e4 in -[NSArrayController
_selectObjectsAtIndexesNoCopy:avoidsEmptySelection:sendObserverNotifications:forceUpdate
:]
#11 0x93358f8b in -[NSArrayController setSelectionIndexes:]
#12 0x0001c49a in -[PagesViewController restoreSelectedPage] at
PagesViewController.m:30
#13 0x0001c5b8 in -[PagesViewController
observeValueForKeyPath:ofObject:change:context:] at
PagesViewController.m:53
#14 0x95ab40ce in NSKVONotify
#15 0x95a447d5 in -[NSObject(NSKeyValueObservingPrivate)
_notifyObserversForKeyPath:change:]
#16 0x9313ce92 in -[NSController _notifyObserversForKeyPath:change:]
#17 0x9313cd93 in -[NSController didChangeValueForKey:]
#18 0x934f70f1 in -[NSArrayController(NSManagedController)
_performFetchWithRequest:merge:error:]
#19 0x93653ee7 in -[NSObjectController(NSManagedController)
fetchWithRequest:merge:error:]
#20 0x93653f6d in -[NSObjectController(NSManagedController)
_executeFetch:didCommitSuccessfully:actionSender:]
#21 0x93783346 in _NSSendCommitEditingSelector
#22 0x9356a2b0 in -[NSController
_controllerEditor:didCommit:contextInfo:]
#23 0x9584da7d in __invoking___
#24 0x9584d468 in -[NSInvocation invoke]
#25 0x9584d538 in -[NSInvocation invokeWithTarget:]
#26 0x95a6895e in __NSFireDelayedPerform
#27 0x957ceb3e in CFRunLoopRunSpecific
#28 0x957cecf8 in CFRunLoopRunInMode
#29 0x9635dda4 in RunCurrentEventLoopInMode
#30 0x9635dbbd in ReceiveNextEventCommon
#31 0x9635da31 in BlockUntilNextEventMatchingListInMode
#32 0x93155505 in _DPSNextEvent
#33 0x93154db8 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#34 0x9314ddf3 in -[NSApplication run]
#35 0x9311b030 in NSApplicationMain
#36 0x000036f6 in main at main.m:14
Basically, what happens is the selected item in a table is getting
restored and when the selection changes a page is being laid out
showing the contents of the selected page. It is during this page
display that I'm doing the HTML conversion.
Sometimes I get this stack trace:
#0 0x9114e695 in _class_isInitialized
#1 0x911444ea in _class_lookupMethodAndLoadCache
#2 0x91154736 in objc_msgSend
#3 0x9335eb02 in -[NSTableBinder _updateSelectionIndexes:]
#4 0x9335e18f in -[NSTableBinder
_observeValueForKeyPath:ofObject:context:]
#5 0x9335de89 in -[NSTableBinder
observeValueForKeyPath:ofObject:change:context:]
#6 0x95ab40ce in NSKVONotify
#7 0x95a447d5 in -[NSObject(NSKeyValueObservingPrivate)
_notifyObserversForKeyPath:change:]
#8 0x9313ce92 in -[NSController _notifyObserversForKeyPath:change:]
#9 0x9313cd93 in -[NSController didChangeValueForKey:]
#10 0x93358e22 in -[NSArrayController
didChangeValuesForArrangedKeys:objectKeys:indexKeys:]
#11 0x933592e4 in -[NSArrayController
_selectObjectsAtIndexesNoCopy:avoidsEmptySelection:sendObserverNotifications:forceUpdate
:]
#12 0x93358f8b in -[NSArrayController setSelectionIndexes:]
#13 0x0001c49a in -[PagesViewController restoreSelectedPage] at
PagesViewController.m:30
#14 0x0001c5b8 in -[PagesViewController
observeValueForKeyPath:ofObject:change:context:] at
PagesViewController.m:53
#15 0x95ab40ce in NSKVONotify
#16 0x95a447d5 in -[NSObject(NSKeyValueObservingPrivate)
_notifyObserversForKeyPath:change:]
#17 0x9313ce92 in -[NSController _notifyObserversForKeyPath:change:]
#18 0x9313cd93 in -[NSController didChangeValueForKey:]
#19 0x934f70f1 in -[NSArrayController(NSManagedController)
_performFetchWithRequest:merge:error:]
#20 0x93653ee7 in -[NSObjectController(NSManagedController)
fetchWithRequest:merge:error:]
#21 0x93653f6d in -[NSObjectController(NSManagedController)
_executeFetch:didCommitSuccessfully:actionSender:]
#22 0x93783346 in _NSSendCommitEditingSelector
#23 0x9356a2b0 in -[NSController
_controllerEditor:didCommit:contextInfo:]
#24 0x9584da7d in __invoking___
#25 0x9584d468 in -[NSInvocation invoke]
#26 0x9584d538 in -[NSInvocation invokeWithTarget:]
#27 0x95a6895e in __NSFireDelayedPerform
#28 0x957ceb3e in CFRunLoopRunSpecific
#29 0x957cecf8 in CFRunLoopRunInMode
#30 0x9635dda4 in RunCurrentEventLoopInMode
#31 0x9635dbbd in ReceiveNextEventCommon
#32 0x9635da31 in BlockUntilNextEventMatchingListInMode
#33 0x93155505 in _DPSNextEvent
#34 0x93154db8 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#35 0x9314ddf3 in -[NSApplication run]
#36 0x9311b030 in NSApplicationMain
#37 0x000036f6 in main at main.m:14
The only table in existence has one column that is bound to the name
property of the object in the array controller whose index is being
updated. I can't see how there is any relation to converting to HTML
and getting this access error. If I just display the plain text HTML I
do not get the error. If I step through it in the debugger sometimes
it works, which leads me to believe it might be some kind of timing
issue related to the run loop since NSAttributedString uses WebKit to
do the HTML conversion. I tried sleeping the thread but it crashes
every time.
Any help or ideas would be appreciated.
Thanks,
Rod Schmidt
infiniteNIL Software
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden