hrev48114 adds 2 changesets to branch 'master' old head: ed04ffb598349c5876905acb21ee898056c6b4a0 new head: 076135838d3ab9e0710f5807bfae689d55091f55 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=0761358+%5Eed04ffb ---------------------------------------------------------------------------- 2315321: Debugger: More tweaks to expression window. - If expression evaluation fails in some way, report it in the result view, rather than popping up a BAlert for it. - Set minimum size on input field. 0761358: Debugger: Locking cleanups. - Using BMessenger as an indirect lock is unnecessary, as BLooper::Lock() checks if the current looper is valid via the global looper list directly. - Fix race conditions. When asked to show various subwindows, lock them before calling Activate(), as the window could otherwise potentially quit in between us checking pointer validity and calling Activate(). - _GetActiveSourceLanguage() needs to acquire a reference to the language object in the case where it's retrieved from the active source code. Otherwise, an unbalanced release would take place when creating the expression window, leading to crashes. Thanks to Stephan for reviewing. [ Rene Gollent <rene@xxxxxxxxxxx> ] ---------------------------------------------------------------------------- 2 files changed, 27 insertions(+), 24 deletions(-) .../team_window/ExpressionEvaluationWindow.cpp | 25 +++++++++---------- .../gui/team_window/TeamWindow.cpp | 26 +++++++++++--------- ############################################################################ Commit: 23153211e5194283af2835f757a8dcd7233304d0 URL: http://cgit.haiku-os.org/haiku/commit/?id=2315321 Author: Rene Gollent <rene@xxxxxxxxxxx> Date: Mon Oct 27 01:57:25 2014 UTC Debugger: More tweaks to expression window. - If expression evaluation fails in some way, report it in the result view, rather than popping up a BAlert for it. - Set minimum size on input field. ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/user_interface/gui/team_window/ExpressionEvaluationWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/ExpressionEvaluationWindow.cpp index a764557..1e29850 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ExpressionEvaluationWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ExpressionEvaluationWindow.cpp @@ -68,6 +68,7 @@ ExpressionEvaluationWindow::_Init() new BMessage(MSG_EVALUATE_EXPRESSION)); BLayoutItem* labelItem = fExpressionInput->CreateLabelLayoutItem(); BLayoutItem* inputItem = fExpressionInput->CreateTextViewLayoutItem(); + inputItem->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET)); inputItem->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -121,22 +122,20 @@ ExpressionEvaluationWindow::MessageReceived(BMessage* message) case MSG_EVALUATE_EXPRESSION: { Value* value = NULL; + BString outputText; status_t error = fLanguage->EvaluateExpression( fExpressionInput->TextView()->Text(), value); if (error != B_OK) { - BString errorText; - errorText.SetToFormat("Failed to evaluate expression: %s", - strerror(error)); - BAlert* alert = new(std::nothrow) BAlert("Evaluate Expression", - errorText.String(), "Close"); - if (alert != NULL) - alert->Go(); - break; - } - - BString valueText; - value->ToString(valueText); - fExpressionOutput->SetText(valueText); + if (value != NULL) + value->ToString(outputText); + else { + outputText.SetToFormat("Failed to evaluate expression: %s", + strerror(error)); + } + } else + value->ToString(outputText); + + fExpressionOutput->SetText(outputText); break; } default: ############################################################################ Revision: hrev48114 Commit: 076135838d3ab9e0710f5807bfae689d55091f55 URL: http://cgit.haiku-os.org/haiku/commit/?id=0761358 Author: Rene Gollent <rene@xxxxxxxxxxx> Date: Mon Oct 27 02:02:37 2014 UTC Debugger: Locking cleanups. - Using BMessenger as an indirect lock is unnecessary, as BLooper::Lock() checks if the current looper is valid via the global looper list directly. - Fix race conditions. When asked to show various subwindows, lock them before calling Activate(), as the window could otherwise potentially quit in between us checking pointer validity and calling Activate(). - _GetActiveSourceLanguage() needs to acquire a reference to the language object in the case where it's retrieved from the active source code. Otherwise, an unbalanced release would take place when creating the expression window, leading to crashes. Thanks to Stephan for reviewing. ---------------------------------------------------------------------------- diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index 0aa5fc3..47ea500 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -161,13 +161,11 @@ TeamWindow::~TeamWindow() if (fSourceView != NULL) fSourceView->UnsetListener(); if (fInspectorWindow != NULL) { - BMessenger messenger(fInspectorWindow); - if (messenger.LockTarget()) + if (fInspectorWindow->Lock()) fInspectorWindow->Quit(); } if (fExpressionWindow != NULL) { - BMessenger messenger(fExpressionWindow); - if (messenger.LockTarget()) + if (fExpressionWindow->Lock()) fExpressionWindow->Quit(); } @@ -312,13 +310,14 @@ TeamWindow::MessageReceived(BMessage* message) case MSG_SHOW_INSPECTOR_WINDOW: { if (fInspectorWindow) { - fInspectorWindow->Activate(true); + AutoLocker<BWindow> lock(fInspectorWindow); + if (lock.IsLocked()) + fInspectorWindow->Activate(true); } else { try { fInspectorWindow = InspectorWindow::Create(fTeam, fListener, this); if (fInspectorWindow != NULL) { - BMessage settings; fInspectorWindow->LoadSettings(fUiSettings); fInspectorWindow->Show(); } @@ -344,9 +343,11 @@ TeamWindow::MessageReceived(BMessage* message) } case MSG_SHOW_EXPRESSION_WINDOW: { - if (fExpressionWindow != NULL) - fExpressionWindow->Activate(true); - else { + if (fExpressionWindow != NULL) { + AutoLocker<BWindow> lock(fExpressionWindow); + if (lock.IsLocked()) + fExpressionWindow->Activate(true); + } else { try { SourceLanguage* language = NULL; if (_GetActiveSourceLanguage(language) != B_OK) @@ -371,8 +372,10 @@ TeamWindow::MessageReceived(BMessage* message) } case MSG_SHOW_BREAK_CONDITION_CONFIG_WINDOW: { - if (fBreakConditionConfigWindow) { - fBreakConditionConfigWindow->Activate(true); + if (fBreakConditionConfigWindow != NULL) { + AutoLocker<BWindow> lock(fBreakConditionConfigWindow); + if (lock.IsLocked()) + fBreakConditionConfigWindow->Activate(true); } else { try { fBreakConditionConfigWindow @@ -1822,6 +1825,7 @@ TeamWindow::_GetActiveSourceLanguage(SourceLanguage*& _language) if (fActiveSourceCode != NULL) { _language = fActiveSourceCode->GetSourceLanguage(); + _language->AcquireReference(); return B_OK; }