Patch 8.2.2113

9 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 8, 2020, 3:13:33 PM12/8/20
to vim...@googlegroups.com

Patch 8.2.2113
Problem: MS-Windows GUI: crash after using ":set guifont=" four times.
Solution: Check for NULL pointer. (Ken Takata, closes #7434)
Files: src/gui_dwrite.cpp, src/testdir/test_gui.vim


*** ../vim-8.2.2112/src/gui_dwrite.cpp 2019-05-05 13:18:45.000000000 +0200
--- src/gui_dwrite.cpp 2020-12-08 21:09:56.080523552 +0100
***************
*** 239,245 ****
if (mItems[n].pTextFormat != item.pTextFormat)
{
SafeRelease(&mItems[n].pTextFormat);
! item.pTextFormat->AddRef();
}
mItems[n] = item;
slide(n);
--- 239,246 ----
if (mItems[n].pTextFormat != item.pTextFormat)
{
SafeRelease(&mItems[n].pTextFormat);
! if (item.pTextFormat != NULL)
! item.pTextFormat->AddRef();
}
mItems[n] = item;
slide(n);
*** ../vim-8.2.2112/src/testdir/test_gui.vim 2020-09-28 21:41:08.612043808 +0200
--- src/testdir/test_gui.vim 2020-12-08 21:11:41.412059979 +0100
***************
*** 386,391 ****
--- 386,398 ----
if has('win32')
" Invalid font names are accepted in GTK GUI
call assert_fails('set guifont=xa1bc23d7f', 'E596:')
+
+ " doing this four times used to cause a crash
+ set guifont=
+ set guifont=
+ set guifont=
+ set guifont=
+ set guifont=
endif

if has('xfontset')
*** ../vim-8.2.2112/src/version.c 2020-12-08 20:39:11.361180690 +0100
--- src/version.c 2020-12-08 21:09:01.056765955 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2113,
/**/

--
Kisses may last for as much as, but no more than, five minutes.
[real standing law in Iowa, United States of America]

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Dec 8, 2020, 3:29:35 PM12/8/20
to vim...@googlegroups.com


> Am 08.12.2020 um 21:13 schrieb Bram Moolenaar <Br...@moolenaar.net>:
> 
> Patch 8.2.2113
> Problem: MS-Windows GUI: crash after using ":set guifont=" four times.
> Solution: Check for NULL pointer. (Ken Takata, closes #7434)
> Files: src/gui_dwrite.cpp, src/testdir/test_gui.vim

Thanks!
I think the test additionally needs a :set renderoptions=type:directx
or perhaps should test with both setting with and without renderoptions.

Thanks,
Christian

Christian Brabandt

unread,
Dec 9, 2020, 2:25:46 AM12/9/20
to vim...@googlegroups.com
The current test does not make gvim crash. How about to change the test like this:

for item in ['type:directx', '']
exe ':set renderoptions='.item
set guifont=Consolas:h9
" doing this four times used to cause a crash
for i in range(5)
set guifont=
endfor
" force a redraw
redraw!
endfor

Unfortunately, this still does not make my gvim crash. So apparently,
something else is needed to make `:set guifn=` make gvim crash.

(I already tried adding `call test_override('char_avail', 1)`, around
it, but this did not change anything). But it might still make sense to
test setting guifont with and withouth setting renderoptions.


Best,
Christian
--
Jetzt wächst zusammen, was zusammen gehört.
-- Willy Brandt
Reply all
Reply to author
Forward
0 new messages