Re: [PATCH v3 0/1] MR5957: win32u: fix random crash without libfreetype
Fabian Maurer (@DarkShadow44) commented about dlls/win32u/sysparams.c:
'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H', 'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
- if (metric && !NtGdiGetTextMetricsW( hdc, metric, 0 )) return 0; + if (metric && !NtGdiGetTextMetricsW( hdc, metric, 0 )) goto fail;
if (!NtGdiGetTextExtentExW( hdc, abcdW, ARRAYSIZE(abcdW), 0, NULL, NULL, &sz, 0 )) - return 0; + goto fail;
if (height) *height = sz.cy; return (sz.cx / 26 + 1) / 2; +fail: + if (height) *height = 1; + return 0;
Just curious, but why `1`? Also, wouldn't it be easier to have `if (height) *height = 1;` at the beginning of the function? Then you could keep the rest the same. And maybe that function could zero the `metrics` as well? Not sure where it would be required, I find a setup without freetype strange to begin with. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5957#note_77190
participants (1)
-
Fabian Maurer (@DarkShadow44)