• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Java_com_apple_cocoa_application_NSText_scrollRangeToVisible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Java_com_apple_cocoa_application_NSText_scrollRangeToVisible


  • Subject: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible
  • From: David Kocher <email@hidden>
  • Date: Sun, 25 Apr 2004 20:13:51 +0200

Hi cocoa devs,
I experience random crashes with the following code snippet

public void log(String message) {
this.textView.textStorage().replaceCharactersInRange(new NSRange(textView.textStorage().length(), 0), message + "\n"); // @warning very bad performance
this.textView.setFont(NSFont.userFixedPitchFontOfSize(9.0f));
this.textView.scrollRangeToVisible(new NSRange(textView.textStorage().length(), 0));
}

The stack trace usually looks similar to this one

Thread 11 Crashed:
0 libobjc.A.dylib 0x908311f4 objc_msgSend + 0x14
1 com.apple.AppKit 0x92e17a20 -[NSClipView _scrollTo:animate:] + 0x138
2 com.apple.AppKit 0x92e7a4b0 -[NSClipView _scrollTo:] + 0x24
3 com.apple.AppKit 0x92e25e74 -[NSClipView viewFrameChanged:] + 0xf4
4 com.apple.Foundation 0x909f793c _nsnote_callback + 0xb0
5 com.apple.CoreFoundation 0x901aa680 __CFXNotificationPost + 0x1b4
6 com.apple.CoreFoundation 0x901af090 _CFXNotificationPostNotification + 0x340
7 com.apple.Foundation 0x909f5788 -[NSNotificationCenter postNotificationName:object:userInfo:] + 0x74
8 com.apple.AppKit 0x92dfcc88 -[NSView _postFrameChangeNotification] + 0x60
9 com.apple.AppKit 0x92e773c4 -[NSView setPostsFrameChangedNotifications:] + 0x60
10 com.apple.AppKit 0x92e31364 -[NSTextView(NSPrivate) _scrollRangeToVisible:forceCenter:] + 0x4c0
11 libAppKitJava.B.dylib 0x88661ed4 Java_com_apple_cocoa_application_NSText_scrollRangeToVisible + 0x84


I suppose the problem is that this method is called from a non-GUI thread (please note: this is cocoa-java). Would it help if I implement something similar to SwingUtilties.invokeLater() ?

Thanks for any help :)
-dk
_______________________________________________
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.


  • Follow-Ups:
    • Re: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Re: Unarchive consistency errors
  • Next by Date: Re: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible
  • Previous by thread: Re: Unarchive consistency errors
  • Next by thread: Re: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible
  • Index(es):
    • Date
    • Thread