Tk Source Code

View Ticket
Login
Ticket UUID: 9672eedd70ffb9cb1b481b9119e64067d3f17238
Title: TkTable crashes in XCopyArea when using Spanish accents on old macOS systems
Type: Bug Version: 8.6.9
Submitter: Takamoto Created on: 2019-02-27 08:44:48
Subsystem: 79. L10N Assigned To: marc_culler
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2020-09-01 19:27:21
Resolution: Works For Me Closed By: marc_culler
    Closed on: 2020-09-01 19:27:21
Description:
Hello guys,

thank you for your great job. I have noticed the following problem:
- Tcl/Tk 8.6.9 compiled as frameworks on macOS Mojave using the standard procedure described on this site
- My Tk application runs fine so far on Mojave
- PROBLEM: On older OS, tested on El Capitan and HighSierra, the very same application fires a "segmentation fault" when inserting text in table widget (I use a composite Widget). I could not precisely identify what exactly fires this segmentation error (probably some accented characters?)
- The same application works fine on older OS if I used Tcl/Tk 8.6.8.compiled on older OS (not Mojave)

I do not have better error description. The application just fires "segmentation fault".

Note: I access Tk through Perl and Tcl::pTk module, but this shouldn't relate to the problem.

I am available to give you any other details if needed.

Best,
Takamoto
User Comments: marc_culler (claiming to be Marc Culler) added on 2020-09-01 19:27:21:
It seems that the crashes are no longer happening and the Tktable issues
are understood and documented in other tickets.  So I don't think this
ticket is serving any purpose and I will close it.

chrstphrchvz added on 2020-08-21 22:02:13:

As I described in [685ac30727]: "even if it were possible to recurse into drawRect:, it would never yield what we want; drawing the table from scratch would only result in TableDisplay()XCopyArea()TkMacOSXBitmapRepFromDrawableRect()drawRect: being called all over again." All three crash reports attached here illustrate this unbounded recursion due to XCopyArea() using cacheDisplayInRect: as of 8.6.9, which only stopped recursive drawRect: calls on macOS 10.14 and later ([c15f0915d1]); in Tk 8.6.10, recursive drawRect: calls are stopped regardless of macOS version ([a9dfe4052f]).


marc_culler (claiming to be Marc Culler) added on 2020-08-21 18:24:45:
@Takamoto: I noticed this old open ticket when it got reclassified as a
localization issue.  But it was actually a problem with tkTable and the
crash occurred in XCopyArea.  There are known problems with XCopyArea
and with its use in tkTable.  Ticket [b505e5f6a9] led to changes which
now make it possible to patch one line of tkTable.c to make it not use
XCopyArea and therefore not run into any issues with it.

It is also possible that this bug was fixed by changes to text handling
on macOS that were made some time ago.

So I am wondering if this problem still exists with the current tip of
core-8-6-branch and, if so, whether it can be fixed by recompiling tkTable
after making the change mentioned in that ticket (namely, comment out
line 1684 of TkTable.c in TkTable2.10, which says: #define NO_XSETCLIP).

Takamoto added on 2019-04-27 14:11:47:
Please, find attached Report3 which has been obtained on the same computer with the same application using Frameworks 8.6.9 (the number 8.6.8 in the report is wrong, I can assure it is 8.6.9) and Tktable compiled on Mojave against the same Frameworks. I hope the report has more details. I simply used the Tk_debug executable.

It seems the program crashes when displaying non-English letters (in my case Spanish words with accents) which should be encoded in utf8.

marc_culler (claiming to be Marc Culler) added on 2019-04-07 18:09:26:

Does it prevent your crash if you limit the text to ASCII characters?

Your report looks promising, but it would be a lot easier to debug if you have debugging symbols enabled when you generate the crash. There is probably a better way to do this, but I usually just run these commands:

$ pushd /Library/Frameworks/Tk.framework/Versions/8.6

$ sudo cp Tk_debug Tk

$ popd

You can save the library Tk first, if you want, but it will be rebuilt the next time that you build Tk.


fvogel added on 2019-04-07 09:54:18:
Attachment "report2.txt" not found, did you perhaps forget to attach it?

Takamoto added on 2019-04-07 09:35:18:
I've finally be abled to compile the Table extension against Tcl/Tk 8.6.9 on Mojave, use this extension in my application (instead of macOS default), pack everything in an .app and run it on El Capitan. The error remains the same. The application crashes as soon as some non Latin characters (I guess) are displayed in the Table. 

Attached the error report (report2.txt)

Takamoto added on 2019-03-06 08:50:30:
Unfortunately, I have not been able to link a correctly compiled Tktable to the Frameworks (I have not found any explanation on the Web). So I am in pause now, but hope to manage it in the next weeks.

marc_culler (claiming to be Marc Culler) added on 2019-03-02 03:50:34:
According to your crash report, your program is using the Tktable extension
/System/Library/Tcl/8.5/Tktable2.10/libTktable2.10.dylib which is part of the
Tcl/Tk 8.5 that Apple ships with its operating system.  Although it
appears that Tktable has not changed in over 10 years, it is possible that it
needs to be built with the Tk 8.6.9 headers in order to be compatible with
the Tk 8.6.9 library that you are using elsewhere in your program.

I suggest that you download, build and install the Tktable source code from
sourceforge, making sure that you use the Tk 8.6.9 headers when you compile it.

I would be interested to know whether that helps, so please report back what
happens.

Takamoto added on 2019-03-01 23:31:50:
Note: I am using Aqua.

chrstphrchvz added on 2019-02-28 08:39:26:

As Marc Culler pointed out it might help to retrieve a crash report, which you can get from Applications > Utilities > Console then looking under User Reports. Once you've found one, you can do File > "Reveal in Finder" and add it as an attachment here.


marc_culler (claiming to be Marc Culler) added on 2019-02-27 19:04:55:
Do you get a crash report?

If so, please try running your application with the debug version of Tk, i.e.
using:
/Library/Frameworks/Tk.framework/Versions/8.6/Tk_debug
instead of:
/Library/Frameworks/Tk.framework/Versions/8.6/Tk
and post the crash report that you get.

Attachments: