From 20f0b4b37858b283b17068acd7560933954b8b2c Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 4 May 2016 15:55:57 +0200 Subject: [PATCH] src/gui/widget/messagebox.cpp fix egfault if Text after call is deleted (lua script error) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2d7c22cff06699541efeb00af8998e118b86d784 Author: Jacek Jendrzej Date: 2016-05-04 (Wed, 04 May 2016) --- src/gui/widget/messagebox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/messagebox.cpp b/src/gui/widget/messagebox.cpp index 835ff9e20..21319d493 100644 --- a/src/gui/widget/messagebox.cpp +++ b/src/gui/widget/messagebox.cpp @@ -289,7 +289,8 @@ int CMessageBox::exec(int timeout) int ShowMsg(const neutrino_locale_t Caption, const char * const Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout) { - CMessageBox* messageBox = new CMessageBox(Caption, Text, Width, Icon, Default, ShowButtons); + std::string tmpText = Text; + CMessageBox* messageBox = new CMessageBox(Caption, tmpText.c_str(), Width, Icon, Default, ShowButtons); messageBox->returnDefaultValueOnTimeout(returnDefaultOnTimeout); messageBox->exec(timeout); int res = messageBox->result; @@ -300,7 +301,8 @@ int ShowMsg(const neutrino_locale_t Caption, const char * const Text, const CMes int ShowMsg(const std::string &Caption, const char * const Text, const CMessageBox::result_ &Default, const uint32_t ShowButtons, const char * const Icon, const int Width, const int timeout, bool returnDefaultOnTimeout) { - CMessageBox* messageBox = new CMessageBox(Caption, Text, Width, Icon, Default, ShowButtons); + std::string tmpText = Text; + CMessageBox* messageBox = new CMessageBox(Caption, tmpText.c_str(), Width, Icon, Default, ShowButtons); messageBox->returnDefaultValueOnTimeout(returnDefaultOnTimeout); messageBox->exec(timeout); int res = messageBox->result;