Skip to content

Commit 1b3e072

Browse files
committed
patch 8.2.2113: MS-Windows GUI: crash after using ":set guifont=" four times
Problem: MS-Windows GUI: crash after using ":set guifont=" four times. Solution: Check for NULL pointer. (Ken Takata, closes #7434)
1 parent ac665c2 commit 1b3e072

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/gui_dwrite.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ class FontCache {
239239
if (mItems[n].pTextFormat != item.pTextFormat)
240240
{
241241
SafeRelease(&mItems[n].pTextFormat);
242-
item.pTextFormat->AddRef();
242+
if (item.pTextFormat != NULL)
243+
item.pTextFormat->AddRef();
243244
}
244245
mItems[n] = item;
245246
slide(n);

src/testdir/test_gui.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,13 @@ func Test_set_guifont()
386386
if has('win32')
387387
" Invalid font names are accepted in GTK GUI
388388
call assert_fails('set guifont=xa1bc23d7f', 'E596:')
389+
390+
" doing this four times used to cause a crash
391+
set guifont=
392+
set guifont=
393+
set guifont=
394+
set guifont=
395+
set guifont=
389396
endif
390397

391398
if has('xfontset')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2113,
753755
/**/
754756
2112,
755757
/**/

0 commit comments

Comments
 (0)