Index: tests/entry.test ================================================================== --- tests/entry.test +++ tests/entry.test @@ -9,12 +9,10 @@ package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] - # For xscrollcommand set scrollInfo {} proc scroll args { global scrollInfo set scrollInfo $args @@ -891,11 +889,11 @@ .e delete 6 .e get } -cleanup { destroy .e } -result 0123457890 -test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -constraints failsOnXQuarz -setup { +test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e ; update idletasks update set x {} } -body { @@ -1009,11 +1007,11 @@ } -body { .e index 0 } -cleanup { destroy .e } -returnCodes {ok} -match glob -result {*} -test entry-3.35 {EntryWidgetCmd procedure, "index" widget command} -constraints failsOnXQuarz -setup { +test entry-3.35 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e pack .e ; update idletasks update } -body { # UTF Index: tests/spinbox.test ================================================================== --- tests/spinbox.test +++ tests/spinbox.test @@ -9,12 +9,10 @@ package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] - # For xscrollcommand set scrollInfo {} proc scroll args { global scrollInfo set scrollInfo $args @@ -1229,11 +1227,11 @@ .e delete 6 .e get } -cleanup { destroy .e } -result 0123457890 -test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -constraints failsOnXQuarz -setup { +test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e update set x {} } -body { @@ -1347,11 +1345,11 @@ } -body { .e index 0 } -cleanup { destroy .e } -returnCodes {ok} -match glob -result {*} -test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -constraints failsOnXQuarz -setup { +test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e pack .e update } -body { # UTF Index: unix/tkUnixFont.c ================================================================== --- unix/tkUnixFont.c +++ unix/tkUnixFont.c @@ -240,10 +240,37 @@ static int SeenName(const char *name, Tcl_DString *dsPtr); /* *------------------------------------------------------------------------- * + * XLoadQueryFontNoXError -- + * + * This function is XLoadQueryFont wrapped in a NULL error handler. + * It is a temporary workaround for ticket [36e379c01b], + * "macOS Ventura, X11 build with XQuartz: crash in XLoadQueryFont", + * which actually is issue #216 in XQuartz: + * https://github.com/XQuartz/XQuartz/issues/216 + * + *------------------------------------------------------------------------- + */ + +static XFontStruct * +XLoadQueryFontNoXError(Display *display, char *name) +{ + XFontStruct *fontStructPtr = NULL; + Tk_ErrorHandler handler; + + /* 45 is the major opcode of X_OpenFont */ + handler = Tk_CreateErrorHandler(display, BadValue, 45, -1, NULL, NULL); + fontStructPtr = XLoadQueryFont(display, name); + Tk_DeleteErrorHandler(handler); + return fontStructPtr; +} + +/* + *------------------------------------------------------------------------- + * * FontPkgCleanup -- * * This function is called when an application is created. It initializes * all the structures that are used by the platform-dependent code on a * per application basis. @@ -488,11 +515,11 @@ } if ((dashes < 14) && !hasWild && hasSpace) { return NULL; } - fontStructPtr = XLoadQueryFont(Tk_Display(tkwin), name); + fontStructPtr = XLoadQueryFontNoXError(Tk_Display(tkwin), (char *)name); if (fontStructPtr == NULL) { /* * Handle all names that look like XLFDs here. Otherwise, when * TkpGetFontFromAttributes is called from generic code, any foundry * or encoding information specified in the XLFD will have been parsed @@ -743,11 +770,11 @@ void TkpGetFontAttrsForChar( Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ - int c, /* Character of interest */ + int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ { FontAttributes atts; UnixFont *fontPtr = (UnixFont *) tkfont; /* Structure describing the logical font */ @@ -2601,15 +2628,15 @@ } *str = '\0'; snprintf(buf, sizeof(buf), "%.200s-%d-*-*-*-*-*%s", nameList[bestIdx[1]], (int)(-wantPtr->fa.size+0.5), rest); *str = '-'; - fontStructPtr = XLoadQueryFont(display, buf); + fontStructPtr = XLoadQueryFontNoXError(display, buf); bestScore[1] = INT_MAX; } if (fontStructPtr == NULL) { - fontStructPtr = XLoadQueryFont(display, nameList[bestIdx[0]]); + fontStructPtr = XLoadQueryFontNoXError(display, nameList[bestIdx[0]]); if (fontStructPtr == NULL) { /* * This shouldn't happen because the font name is one of the names * that X gave us to use, but it does anyhow. */ @@ -2645,13 +2672,13 @@ GetSystemFont( Display *display) /* Display for new XFontStruct. */ { XFontStruct *fontStructPtr; - fontStructPtr = XLoadQueryFont(display, "fixed"); + fontStructPtr = XLoadQueryFontNoXError(display, "fixed"); if (fontStructPtr == NULL) { - fontStructPtr = XLoadQueryFont(display, "*"); + fontStructPtr = XLoadQueryFontNoXError(display, "*"); if (fontStructPtr == NULL) { Tcl_Panic("TkpGetFontFromAttributes: cannot get any font"); } } return fontStructPtr;