[Tcl-bugs] [ tktoolkit-Bugs-2907388 ] Entering circumflex '^' into entry crashes TkAqua 8.6b1.1

View: New views
1 Messages — Rating Filter:   Alert me  

[Tcl-bugs] [ tktoolkit-Bugs-2907388 ] Entering circumflex '^' into entry crashes TkAqua 8.6b1.1

by SourceForge.net :: Rate this Message:

| View Threaded | Show Only this Message

Bugs item #2907388, was opened at 2009-12-02 11:25
Message generated for change (Comment added) made by treincke
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112997&aid=2907388&group_id=12997

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: 07. [entry]
Group: development: 8.6b1.1
Status: Open
Resolution: None
Priority: 9
Private: No
Submitted By: Torsten Berg (treincke)
Assigned to: Daniel A. Steffen (das)
Summary: Entering circumflex '^' into entry crashes TkAqua 8.6b1.1

Initial Comment:
The following script:

% entry .e
% pack .e

will crash TkAqua8.6b1.1 when entering a circumflex (the ^ character) into the entry. This is true for both the i386 and the x86_64 builds. The error message is:

2009-12-02 11:17:30.936 wish-aqua8.6[6459:903] An uncaught exception was raised
2009-12-02 11:17:30.939 wish-aqua8.6[6459:903] *** -[NSCFString characterAtIndex:]: Range or index out of bounds
2009-12-02 11:17:31.023 wish-aqua8.6[6459:903] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFString characterAtIndex:]: Range or index out of bounds'
*** Call stack at first throw:
(
        0   CoreFoundation                      0x00007fff85879444 __exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x00007fff8496d0f3 objc_exception_throw + 45
        2   CoreFoundation                      0x00007fff85879267 +[NSException raise:format:arguments:] + 103
        3   CoreFoundation                      0x00007fff858791f4 +[NSException raise:format:] + 148
        4   Foundation                          0x00007fff801803d5 -[NSCFString characterAtIndex:] + 97
        5   Tk                                  0x00000001000c52e0 Tk_SetCaretPos + 674
        6   Tk                                  0x00000001000cb9db Tk_MacOSXSetupTkNotifier + 701
        7   Tcl                                 0x00000001001f4486 Tcl_DoOneEvent + 297
        8   Tk                                  0x000000010001d8e0 Tk_MainLoop + 24
        9   Tk                                  0x000000010002b36a Tk_MainEx + 1491
        10  wish-aqua8.6                        0x000000010000548b 0x0 + 4294988939
        11  wish-aqua8.6                        0x00000001000053d0 0x0 + 4294988752
        12  ???                                 0x0000000000000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Abort trap


----------------------------------------------------------------------

>Comment By: Torsten Berg (treincke)
Date: 2011-01-23 12:42

Message:
I uploaded a patched version of the file tkMacOSXKeyEvent.c (patched from
cvs revision 1.30) that circumvents the bug by catching the condition that
causes the crash in [characterAtIndex].

This will let the character through, but not the accent used to make the
composed character.

----------------------------------------------------------------------

Comment By: Ned Deily ()
Date: 2011-01-22 21:23

Message:
This is a really nasty bug and, with the release of Cocoa Tk backports to
Tk 8.5, as in the Tcl/Tk 8.5.7 shipped by Apple in Mac OS X 10.6 and the
recent ActiveState Tcl/Tk 8.5.9, it is impacting more applications and
users.  In OS X 10.6, the Apple-supplied Python Tkinter modules and, thus,
IDLE are susceptible to this crash: /usr/bin/idle2.6 and, with the US
Extended input method, type Option-u (umlaut combiner) or Option-n (tilde
combiner), for instance.  For the Python Software Foundation (python.org)
Python installers for OS X, we were intending to support 64-bit Python with
a recommendation to use the ActiveState 8.5.9 Tcl/Tk (since the
Apple-supplied one has so many other problems with Tkinter and IDLE) but
this easy crasher seems to be a show stopper for that
(http://bugs.python.org/issue10973).  I see that postfix combining
characters (like Shift-Option-u) work without crashing.  It also appears
that the system Character Viewer input does not work at all.

Any prognosis on a fix for this problem?

----------------------------------------------------------------------

Comment By: Uldis (captsolo)
Date: 2010-11-15 23:01

Message:
As pointed out in comment from 2010-06-25, this crash happens for [all]
composite characters.

In my case, a Tkinter app crashed when entering accented Latvian character
using the ' (single quote) modifier key. Input locale on Mac OS X 10.6 was
set to Latvian.

Out of the two ways for entering the same accented character - using a
"sticky" single quote key followed by the letter char or pressing Opt-
together with the letter char - the former causes the crash while the
latter shows the correct character. This confirms that the crash is caused
by the "sticky" modifier key and not by the accented character itself.

----------------------------------------------------------------------

Comment By: Donal K. Fellows (dkf)
Date: 2010-07-05 01:18

Message:
It's the composing circumflex (Option-i) that causes trouble.

----------------------------------------------------------------------

Comment By: Torsten Berg (treincke)
Date: 2010-07-02 15:10

Message:
This seems to be related to this discussion:

http://www.cocoabuilder.com/archive/cocoa/181364-characteratindex-method-and-composite-characters.html


Maybe, it is not the right choice to use characterAtIndex here?

Can we raise this ticket to prio 9? It seems very important to me to being
able to use accented characters in TkAqua.

----------------------------------------------------------------------

Comment By: Torsten Berg (treincke)
Date: 2010-06-25 12:58

Message:
I tracked this down to be more general. This error occurs everytime you try
to insert an accented character into an entry or text widget (or editable
combobox or whatever text input widget), i.e. everywhere a key event is
triggered. If you enter one of the following keys used for composed
characters ´`^~¨ (keycodes 24, 24+Shift, 10, 45+alt, 32+alt), Tk crashes.

The problem is in tkProcessKeyEvent (file tkMacOSXKeyEvent.c, line 151).
The method

[characters characterAtIndex:0] fails, because there are no characters in
this event, only the keycode. There are also no modifiers at this moment
([theEvent modifierFlags] in line 54).

The problem seems to be that this special case is just not
handled/implemented. Unfortunately, my knowledge of events and all the
functions in the Tk core involved here, is limited, so I can not really fix
it. I tried several things but the only success was to avoid the crash
without anything being inserted into the entry.

So, what is missing here, seems to me:

1. Enter one of the above keys (there may be some others) -> insert the
corresponding character into the entry/text/whatever and select it with
yellow color to mark it as special (see also section 'Setting Focus and
Selection Programmatically' on
http://developer.apple.com/mac/library/documentation/TextFonts/Conceptual/CocoaTextArchitecture/TextEditing/TextEditing.html)

2. Enter a character that can be composed of the first one and the current
one -> delete the selection and insert the composed character instead. If
no such composed character exists just leave the first character alone and
add the current one (maybe some special treatment for 'space').



----------------------------------------------------------------------

Comment By: Daniel A. Steffen (das)
Date: 2010-02-10 00:20

Message:
also see 2948152

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112997&aid=2907388&group_id=12997

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Tcl-Bugs mailing list
Tcl-Bugs@...
https://lists.sourceforge.net/lists/listinfo/tcl-bugs