Blame 0001-patch-8.1.0121-crash-when-using-ballooneval-related-.patch

eec325
From 1e36677f8d4c57bb0e90b8a1136c392cc3b301c7 Mon Sep 17 00:00:00 2001
eec325
From: Bram Moolenaar <Bram@vim.org>
eec325
Date: Thu, 28 Jun 2018 12:05:11 +0200
eec325
Subject: [PATCH] patch 8.1.0121: crash when using ballooneval related to
eec325
 'vartabstop'
eec325
eec325
Problem:    Crash when using ballooneval related to 'vartabstop'.
eec325
Solution:   Initialize balloonEval->vts to NULL. (Markus Braun)
eec325
---
eec325
 src/ex_cmds2.c  |  2 +-
eec325
 src/gui.c       |  5 +++++
eec325
 src/gui_beval.c | 11 +----------
eec325
 src/gui_w32.c   |  9 +--------
eec325
 src/version.c   |  2 ++
eec325
 5 files changed, 10 insertions(+), 19 deletions(-)
eec325
eec325
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
eec325
index 01bc357f4..5f58fedfb 100644
eec325
--- a/src/ex_cmds2.c
eec325
+++ b/src/ex_cmds2.c
eec325
@@ -1419,7 +1419,7 @@ check_due_timer(void)
eec325
 	    bevalexpr_due_set = FALSE;
eec325
 	    if (balloonEval == NULL)
eec325
 	    {
eec325
-		balloonEval = (BalloonEval *)alloc(sizeof(BalloonEval));
eec325
+		balloonEval = (BalloonEval *)alloc_clear(sizeof(BalloonEval));
eec325
 		balloonEvalForTerm = TRUE;
eec325
 	    }
eec325
 	    if (balloonEval != NULL)
eec325
diff --git a/src/gui.c b/src/gui.c
eec325
index 87ea5ce2b..f51b81f86 100644
eec325
--- a/src/gui.c
eec325
+++ b/src/gui.c
eec325
@@ -745,7 +745,12 @@ gui_init(void)
eec325
 	/* Always create the Balloon Evaluation area, but disable it when
eec325
 	 * 'ballooneval' is off. */
eec325
 	if (balloonEval != NULL)
eec325
+	{
eec325
+# ifdef FEAT_VARTABS
eec325
+	    vim_free(balloonEval->vts);
eec325
+# endif
eec325
 	    vim_free(balloonEval);
eec325
+	}
eec325
 	balloonEvalForTerm = FALSE;
eec325
 # ifdef FEAT_GUI_GTK
eec325
 	balloonEval = gui_mch_create_beval_area(gui.drawarea, NULL,
eec325
diff --git a/src/gui_beval.c b/src/gui_beval.c
eec325
index 7e4625080..49694cfdd 100644
eec325
--- a/src/gui_beval.c
eec325
+++ b/src/gui_beval.c
eec325
@@ -111,28 +111,19 @@ gui_mch_create_beval_area(
eec325
 	return NULL;
eec325
     }
eec325
 
eec325
-    beval = (BalloonEval *)alloc(sizeof(BalloonEval));
eec325
+    beval = (BalloonEval *)alloc_clear(sizeof(BalloonEval));
eec325
     if (beval != NULL)
eec325
     {
eec325
 #ifdef FEAT_GUI_GTK
eec325
 	beval->target = GTK_WIDGET(target);
eec325
-	beval->balloonShell = NULL;
eec325
-	beval->timerID = 0;
eec325
 #else
eec325
 	beval->target = (Widget)target;
eec325
-	beval->balloonShell = NULL;
eec325
-	beval->timerID = (XtIntervalId)NULL;
eec325
 	beval->appContext = XtWidgetToApplicationContext((Widget)target);
eec325
 #endif
eec325
 	beval->showState = ShS_NEUTRAL;
eec325
-	beval->x = 0;
eec325
-	beval->y = 0;
eec325
 	beval->msg = mesg;
eec325
 	beval->msgCB = mesgCB;
eec325
 	beval->clientData = clientData;
eec325
-#ifdef FEAT_VARTABS
eec325
-	beval->vts = NULL;
eec325
-#endif
eec325
 
eec325
 	/*
eec325
 	 * Set up event handler which will keep its eyes on the pointer,
eec325
diff --git a/src/gui_w32.c b/src/gui_w32.c
eec325
index 855381108..147d98b39 100644
eec325
--- a/src/gui_w32.c
eec325
+++ b/src/gui_w32.c
eec325
@@ -8922,28 +8922,21 @@ gui_mch_create_beval_area(
eec325
 	return NULL;
eec325
     }
eec325
 
eec325
-    beval = (BalloonEval *)alloc(sizeof(BalloonEval));
eec325
+    beval = (BalloonEval *)alloc_clear(sizeof(BalloonEval));
eec325
     if (beval != NULL)
eec325
     {
eec325
 	beval->target = s_textArea;
eec325
-	beval->balloon = NULL;
eec325
 
eec325
 	beval->showState = ShS_NEUTRAL;
eec325
-	beval->x = 0;
eec325
-	beval->y = 0;
eec325
 	beval->msg = mesg;
eec325
 	beval->msgCB = mesgCB;
eec325
 	beval->clientData = clientData;
eec325
-#ifdef FEAT_VARTABS
eec325
-	beval->vts = NULL;
eec325
-#endif
eec325
 
eec325
 	InitCommonControls();
eec325
 	cur_beval = beval;
eec325
 
eec325
 	if (p_beval)
eec325
 	    gui_mch_enable_beval_area(beval);
eec325
-
eec325
     }
eec325
     return beval;
eec325
 }
eec325
diff --git a/src/version.c b/src/version.c
eec325
index a7a96b396..563a70be6 100644
eec325
--- a/src/version.c
eec325
+++ b/src/version.c
eec325
@@ -789,6 +789,8 @@ static char *(features[]) =
eec325
 
eec325
 static int included_patches[] =
eec325
 {   /* Add new patch number below this line */
eec325
+/**/
eec325
+    121,
eec325
 /**/
eec325
     119,
eec325
 /**/
eec325
-- 
eec325
2.14.4
eec325