diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-01 22:03:04 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-01 22:03:04 (GMT) |
commit | 0f436a709c2c16191b4aa1738c53e0f8b97c1a72 (patch) | |
tree | 6a319182e8f6a5bc27b021153dfe075de7452b43 | |
parent | 378d83e86e6a85a88d282a075c3181abd105be0e (diff) | |
download | tk-0f436a709c2c16191b4aa1738c53e0f8b97c1a72.zip tk-0f436a709c2c16191b4aa1738c53e0f8b97c1a72.tar.gz tk-0f436a709c2c16191b4aa1738c53e0f8b97c1a72.tar.bz2 |
Fix [f5888bbd75a0]: font-5.3 test crashes on Windows in trunk
-rw-r--r-- | win/tkWinFont.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 980fd4b..e48f93c 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -2482,7 +2482,8 @@ GetScreenFont( lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; Tcl_DStringInit(&ds); - wcsncpy(lf.lfFaceName, Tcl_UtfToWCharDString(faceName, -1, &ds), LF_FACESIZE-1); + Tcl_UtfToWCharDString(faceName, -1, &ds); + wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1); Tcl_DStringFree(&ds); lf.lfFaceName[LF_FACESIZE-1] = 0; hFont = CreateFontIndirectW(&lf); @@ -2516,6 +2517,9 @@ FamilyExists( int result; Tcl_DString faceString; + Tcl_DStringInit(&faceString); + Tcl_UtfToWCharDString(faceName, -1, &faceString); + /* * If the family exists, WinFontExistProc() will be called and * EnumFontFamilies() will return whatever WinFontExistProc() returns. If @@ -2523,8 +2527,7 @@ FamilyExists( * non-zero value. */ - Tcl_DStringInit(&faceString); - result = EnumFontFamiliesW(hdc, Tcl_UtfToWCharDString(faceName, -1, &faceString), + result = EnumFontFamiliesW(hdc, (WCHAR *)Tcl_DStringValue(&faceString), (FONTENUMPROCW) WinFontExistProc, 0); Tcl_DStringFree(&faceString); return (result == 0); |