Skip to content

Commit

Permalink
Fix crash when staging/unstaging too fast (or something like that).
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartanJ committed Jan 27, 2025
1 parent 934a1f3 commit 0005f9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/tools/ecode/plugins/debugger/debuggerplugin.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "debuggerplugin.hpp"
#include "../../notificationcenter.hpp"
#include "../../projectbuild.hpp"
#include "../../terminalmanager.hpp"
Expand All @@ -8,6 +7,7 @@
#include "bussocket.hpp"
#include "bussocketprocess.hpp"
#include "dap/debuggerclientdap.hpp"
#include "debuggerplugin.hpp"
#include "models/breakpointsmodel.hpp"
#include "models/processesmodel.hpp"
#include "models/variablesmodel.hpp"
Expand Down Expand Up @@ -1261,7 +1261,11 @@ void DebuggerPlugin::onRegisterDocument( TextDocument* doc ) {
}
} );

doc->setCommand( "debugger-start", [this] { runCurrentConfig(); } );
doc->setCommand( "debugger-start", [this] {
if ( mDebugger )
exitDebugger( true );
runCurrentConfig();
} );

doc->setCommand( "debugger-stop", [this] { exitDebugger( true ); } );

Expand Down
13 changes: 7 additions & 6 deletions src/tools/ecode/plugins/git/gitplugin.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "gitplugin.hpp"
#include "gitbranchmodel.hpp"
#include "gitplugin.hpp"
#include "gitstatusmodel.hpp"
#include <eepp/graphics/primitives.hpp>
#include <eepp/scene/scenemanager.hpp>
Expand Down Expand Up @@ -1583,10 +1583,10 @@ void GitPlugin::buildSidePanelTab() {
} );
mStatusTree->on( Event::OnModelEvent, [this]( const Event* event ) {
const ModelEvent* modelEvent = static_cast<const ModelEvent*>( event );
if ( modelEvent->getModel() == nullptr )
auto modelShared = mStatusTree->getModelShared();
if ( !modelShared )
return;

auto model = static_cast<const GitStatusModel*>( modelEvent->getModel() );
auto model = static_cast<GitStatusModel*>( modelShared.get() );

if ( modelEvent->getModelIndex().internalId() == GitStatusModel::GitFile ) {
const Git::DiffFile* file = model->file( modelEvent->getModelIndex() );
Expand Down Expand Up @@ -1640,10 +1640,11 @@ void GitPlugin::buildSidePanelTab() {
i18n( "git_discard_all", "Discard All" ) );
}

menu->on( Event::OnItemClicked, [this, model, repoPath,
menu->on( Event::OnItemClicked, [this, modelShared, repoPath,
type]( const Event* event ) {
if ( !mGit )
if ( !mGit || !modelShared )
return;
auto model = static_cast<GitStatusModel*>( modelShared.get() );
UIMenuItem* item = event->getNode()->asType<UIMenuItem>();
std::string id( item->getId() );
if ( id == "git-commit" ) {
Expand Down

0 comments on commit 0005f9f

Please sign in to comment.