]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1455: Haiku: dailog objects created with no reference v9.1.1455
authorjinyaoguo <guo846@purdue.edu>
Wed, 11 Jun 2025 19:30:01 +0000 (21:30 +0200)
committerChristian Brabandt <cb@256bit.org>
Wed, 11 Jun 2025 19:30:01 +0000 (21:30 +0200)
Problem:  Haiku: dailog objects created with no reference
Solution: delete the objects before returning (jinyaoguo)

In the functions gui_mch_dialog() and gui_mch_font_dialog(), Dialog
objects are created but never escape the function scope. The call to
dialog->Go() only returns a boolean value and does not retain any
reference to the Dialog object itself, which may lead to potential
memory leak.

Fix this by deleting the object after using it.

closes: #17501

Signed-off-by: jinyaoguo <guo846@purdue.edu>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui_haiku.cc
src/version.c

index 748f97e542f2d6aa3e97bbadef3ea45b5436bc8d..3865a4f4df58cf9786f34d99579b7882707d19b5 100644 (file)
@@ -3820,7 +3820,9 @@ gui_mch_font_dialog(font_family* family, font_style* style, float* size)
 #if defined(FEAT_GUI_DIALOG)
        // gui.vimWindow->Unlock();
     VimSelectFontDialog *dialog = new VimSelectFontDialog(family, style, size);
-    return dialog->Go();
+    bool ret = dialog->Go();
+       delete dialog;
+       return ret;
 #else
     return NOFONT;
 #endif // FEAT_GUI_DIALOG
@@ -4917,7 +4919,9 @@ gui_mch_dialog(
 {
     VimDialog *dialog = new VimDialog(type, (char*)title, (char*)message,
            (char*)buttons, dfltbutton, (char*)textfield, ex_cmd);
-    return dialog->Go();
+    bool ret = dialog->Go();
+    delete dialog;
+       return ret;
 }
 
 #endif // FEAT_GUI_DIALOG
index 5907766573cbf74427f67573f1a8e93305ec5aef..69cf433620de80b24476d93be519b62f3495dceb 100644 (file)
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1455,
 /**/
     1454,
 /**/