The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   Omni Frameworks (http://forums.omnigroup.com/forumdisplay.php?f=16)
-   -   A small bug (http://forums.omnigroup.com/showthread.php?t=22018)

SpiraMira 2011-08-29 07:05 AM

A small bug
 
Hi again -

I somehow triggered a small bug in OUIEditableFrame: the setAttributedText:newContent method bombs (in replaceCharactersInRange) when newContent is nil. My countermeasure is of course simple as you can see below. A simple bit of defensive programming ;-) Don't ask me how since it is simply pulling the Hello.rtf from the picker and just started acting bizarre, possibly a leak in another part of my code (which I am pursuing) ... Anyhoo, worth reporting. You also have the backtrace.

Spira

[QUOTE]
// Called by both -setAttributedText: and -setTextStorage:
- (void)setAttributedText:(NSAttributedString *)newContent
{[INDENT] [self textStorage]; // Make sure our text storage has been created.

OUIEditableFrameMutationOptions options = OUIEditableFrameMutationOptionNotifyInputDelegate;
if (!beforeMutate(self, _cmd, options))
return;
[INDENT] if (_content && newContent) {
int l = [_content length];

[_content replaceCharactersInRange:(NSRange){0, l} withAttributedString:newContent];

afterMutate(self, _cmd, options);
afterContentReplaced(self);
}
[/INDENT][/INDENT]}
[/QUOTE]

Backtrace:

[QUOTE]
bt
#0 -[OUIEditableFrame setAttributedText:] (self=0x11c61d30, _cmd=0x15f057) at /Volumes/Shiva/Users/Me/Development/iPhone/iPhone_Apps/Lux/Framework/OmniGroup/Frameworks/OmniUI/iPad/OUIEditableFrame.m:2270
#1 0x000f96d3 in -[OUIEditableFrame didMoveToWindow] (self=0x11c61d30, _cmd=0x393c238) at /Volumes/Shiva/Users/Me/Development/iPhone/iPhone_Apps/Lux/Framework/OmniGroup/Frameworks/OmniUI/iPad/OUIEditableFrame.m:1812
#2 0x00b375a7 in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
#3 0x00b37244 in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
#4 0x00b413c1 in -[UIScrollView _didMoveFromWindow:toWindow:] ()
#5 0x00b37244 in -[UIView(Internal) _didMoveFromWindow:toWindow:] ()
#6 0x00b33a00 in -[UIView(Hierarchy) _postMovedFromSuperview:] ()
#7 0x00b387b8 in -[UIView(Internal) _addSubview:positioned:relativeTo:] ()
#8 0x00b324bb in -[UIView(Hierarchy) addSubview:] ()
#9 0x0002f1f6 in -[CanvasToolbarViewController _prepareViewControllerForContainment:hidden:] (self=0xbaac940, _cmd=0x160f0e, soonToBeInnerViewController=0x11a60830, hidden=1 '\001') at /Volumes/Shiva/Users/Me/Development/iPhone/iPhone_Apps/Lux/Framework/ImageEditor/Canvas/CanvasToolbarViewController.m:137
#10 0x0002f4d4 in -[CanvasToolbarViewController setInnerViewController:animatingFromView:rect:toView:rect:] (self=0xbaac940, _cmd=0x161033, viewController=0x11a60830, fromView=0xbaa0840, fromViewRect={origin = {x = 0, y = 0}, size = {width = 0, height = 0}}, toView=0x11c61d30, toViewRect={origin = {x = 0, y = 0}, size = {width = 0, height = 0}}) at /Volumes/Shiva/Users/Me/Development/iPhone/iPhone_Apps/Lux/Framework/ImageEditor/Canvas/CanvasToolbarViewController.m:197
#11 0x000301b9 in -[CanvasToolbarViewController setInnerViewController:animatingView:toView:] (self=0xbaac940, _cmd=0x15e8e4, viewController=0x11a60830, fromView=0xbaa0840, toView=0x11c61d30) at /Volumes/Shiva/Users/Me/Development/iPhone/iPhone_Apps/Lux/Framework/ImageEditor/Canvas/CanvasToolbarViewController.m:303
#12 0x00017874 in -[CanvasSingleAppController setupInnerViewControllerForDocument:animated:] (self=0xbaa1e20, _cmd=0x15e957, thisDocument=0x11a5ef10, anim=1 '\001') at /Volumes/Shiva/Users/Me/Development/iPhone/iPhone_Apps/Lux/Framework/ImageEditor/Canvas/CanvasSingleAppController.m:701
#13 0x00017eba in -[CanvasSingleAppController _mainThread_finishedLoadingDocument:] (self=0xbaa1e20, _cmd=0x15e83a, result=0x11a5ef10) at /Volumes/Shiva/Users/Me/Development/iPhone/iPhone_Apps/Lux/Framework/ImageEditor/Canvas/CanvasSingleAppController.m:785
#14 0x026feea2 in -[NSObject performSelector:withObject:] ()
#15 0x0140b98f in __NSThreadPerformPerform ()
#16 0x026d19af in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#17 0x02634bf3 in __CFRunLoopDoSources0 ()
#18 0x026344d4 in __CFRunLoopRun ()
#19 0x02633e34 in CFRunLoopRunSpecific ()
#20 0x02633d4b in CFRunLoopRunInMode ()
#21 0x02c439dd in GSEventRunModal ()
#22 0x02c43aa2 in GSEventRun ()
#23 0x00afba1b in UIApplicationMain ()
#24 0x00002c6d in main (argc=1, argv=0xbffff460) at /Volumes/Shiva/Users/Me/Development/iPhone/iPhone_Apps/Lux/Framework/ImageEditor/Canvas/main.m:29
(gdb)
[/QUOTE]


All times are GMT -8. The time now is 01:24 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.