patch 9.1.1455: Haiku: dailog objects created with no reference
Commit:
https://github.com/vim/vim/commit/ae31d7bfb4ccc47c4843735f70ed68166a6436da
Author: jinyaoguo <[email protected]>
Date: Wed Jun 11 21:30:01 2025 +0200
patch 9.1.1455: Haiku: dailog objects created with no reference
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/gui_haiku.cc b/src/gui_haiku.cc
index 748f97e54..3865a4f4d 100644
--- a/src/gui_haiku.cc
+++ b/src/gui_haiku.cc
@@ -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
diff --git a/src/version.c b/src/version.c
index 590776657..69cf43362 100644
--- a/src/version.c
+++ b/src/version.c
@@ -709,6 +709,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1455,
/**/
1454,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1uPRNe-00DtKO-LR%40256bit.org.