From abed891d1ba9b4410d916bf4cc5daa4233b7072e Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 11 Apr 2015 13:39:33 +0200 Subject: [PATCH] Shortcuts: Fix use-after-free in EditWindow return. Calling Quit() on the window deletes it, so using the fTextControl member to get the result does not work. --- src/preferences/shortcuts/EditWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/preferences/shortcuts/EditWindow.cpp b/src/preferences/shortcuts/EditWindow.cpp index e2e08a65b3..04c8f7a922 100644 --- a/src/preferences/shortcuts/EditWindow.cpp +++ b/src/preferences/shortcuts/EditWindow.cpp @@ -68,7 +68,9 @@ EditWindow::Go() CenterOnScreen(); acquire_sem(fSem); + BString result = fTextControl->Text(); if (Lock()) Quit(); - return fTextControl->Text(); + + return result; }