diff --git a/PCLib/PCEditor.m b/PCLib/PCEditor.m index cb83167..ea9da4f 100644 --- a/PCLib/PCEditor.m +++ b/PCLib/PCEditor.m @@ -54,8 +54,6 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification"; storage = [[NSTextStorage alloc] init]; lm = [[NSLayoutManager alloc] init]; - [storage addLayoutManager:lm]; - RELEASE(lm); rect.origin.x = 0; rect.origin.y = 0; @@ -66,6 +64,9 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification"; [lm addTextContainer:tc]; RELEASE(tc); + [storage addLayoutManager:lm]; + RELEASE(lm); + iView = [[PCEditorView alloc] initWithFrame:rect textContainer:tc]; [iView setEditor:self]; @@ -83,13 +84,14 @@ NSString *PCEditorDidResignKeyNotification=@"PCEditorDidResignKeyNotification"; [[iView textContainer] setWidthTracksTextView:YES]; lm = [[NSLayoutManager alloc] init]; - [storage addLayoutManager:lm]; - RELEASE(lm); tc = [[NSTextContainer alloc] initWithContainerSize:rect.size]; [lm addTextContainer:tc]; RELEASE(tc); + [storage addLayoutManager:lm]; + RELEASE(lm); + eView = [[PCEditorView alloc] initWithFrame:rect textContainer:tc]; [eView setEditor:self];