mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 10:13:22 +00:00
Fix crashing segfault when calling: app.command.CloseFile() or app.command.GotoPreviousTab() , in --batch mode (fix #4352)
This commit is contained in:
parent
02e8d97eed
commit
1896483458
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2024 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -35,6 +36,8 @@ protected:
|
||||
|
||||
bool onEnabled(Context* context) override {
|
||||
Workspace* workspace = App::instance()->workspace();
|
||||
if (!workspace) // Workspace (main window) can be null if we are in --batch mode
|
||||
return false;
|
||||
WorkspaceView* view = workspace->activeView();
|
||||
return (view != nullptr);
|
||||
}
|
||||
@ -62,6 +65,8 @@ protected:
|
||||
|
||||
void onExecute(Context* context) override {
|
||||
Workspace* workspace = App::instance()->workspace();
|
||||
if (!workspace) // Workspace (main window) can be null if we are in --batch mode
|
||||
return;
|
||||
|
||||
// Collect all document views
|
||||
DocViews docViews;
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2024 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -35,6 +36,8 @@ DuplicateViewCommand::DuplicateViewCommand()
|
||||
bool DuplicateViewCommand::onEnabled(Context* context)
|
||||
{
|
||||
Workspace* workspace = App::instance()->workspace();
|
||||
if (!workspace) // Workspace (main window) can be null if we are in --batch mode
|
||||
return false;
|
||||
WorkspaceView* view = workspace->activeView();
|
||||
return (view != nullptr);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2024 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -30,7 +31,10 @@ GotoNextTabCommand::GotoNextTabCommand()
|
||||
|
||||
bool GotoNextTabCommand::onEnabled(Context* context)
|
||||
{
|
||||
return App::instance()->workspace()->canSelectOtherTab();
|
||||
Workspace* workspace = App::instance()->workspace();
|
||||
if (!workspace) // Workspace (main window) can be null if we are in --batch mode
|
||||
return false;
|
||||
return workspace->canSelectOtherTab();
|
||||
}
|
||||
|
||||
void GotoNextTabCommand::onExecute(Context* context)
|
||||
@ -54,7 +58,10 @@ GotoPreviousTabCommand::GotoPreviousTabCommand()
|
||||
|
||||
bool GotoPreviousTabCommand::onEnabled(Context* context)
|
||||
{
|
||||
return App::instance()->workspace()->canSelectOtherTab();
|
||||
Workspace* workspace = App::instance()->workspace();
|
||||
if (!workspace) // Workspace (main window) can be null if we are in --batch mode
|
||||
return false;
|
||||
return workspace->canSelectOtherTab();
|
||||
}
|
||||
|
||||
void GotoPreviousTabCommand::onExecute(Context* context)
|
||||
|
Loading…
x
Reference in New Issue
Block a user