ecode Debugger: Enable the variable context menu options (right-click) in the hover variable menu.

Fix a double free bug in UIWindow.
This commit is contained in:
Martín Lucas Golini
2025-10-15 00:40:13 -03:00
parent 4d61c57e9c
commit 022e680a00
7 changed files with 91 additions and 78 deletions

View File

@@ -2392,9 +2392,11 @@ void DebuggerPlugin::displayTooltip( UICodeEditor* editor, const std::string& ex
tv->setFocusOnSelection( false );
tv->on( Event::OnModelEvent, [this]( const Event* event ) {
if ( !mDebugger || !mListener )
return;
const ModelEvent* modelEvent = static_cast<const ModelEvent*>( event );
if ( mDebugger && mListener &&
modelEvent->getModelEventType() == Abstract::ModelEventType::OpenTree ) {
auto idx( modelEvent->getModelIndex() );
if ( modelEvent->getModelEventType() == Abstract::ModelEventType::OpenTree ) {
ModelVariableNode* node =
static_cast<ModelVariableNode*>( modelEvent->getModelIndex().internalData() );
mDebugger->variables(
@@ -2403,6 +2405,9 @@ void DebuggerPlugin::displayTooltip( UICodeEditor* editor, const std::string& ex
mHoverExpressionsHolder->addVariables( variablesReference,
std::move( vars ) );
} );
} else if ( modelEvent->getModelEventType() == Abstract::ModelEventType::OpenMenu &&
idx.isValid() ) {
mListener->createAndShowVariableMenu( idx );
}
} );