mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-18 02:42:59 +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
|
// Aseprite
|
||||||
|
// Copyright (C) 2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -35,6 +36,8 @@ protected:
|
|||||||
|
|
||||||
bool onEnabled(Context* context) override {
|
bool onEnabled(Context* context) override {
|
||||||
Workspace* workspace = App::instance()->workspace();
|
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();
|
WorkspaceView* view = workspace->activeView();
|
||||||
return (view != nullptr);
|
return (view != nullptr);
|
||||||
}
|
}
|
||||||
@ -62,6 +65,8 @@ protected:
|
|||||||
|
|
||||||
void onExecute(Context* context) override {
|
void onExecute(Context* context) override {
|
||||||
Workspace* workspace = App::instance()->workspace();
|
Workspace* workspace = App::instance()->workspace();
|
||||||
|
if (!workspace) // Workspace (main window) can be null if we are in --batch mode
|
||||||
|
return;
|
||||||
|
|
||||||
// Collect all document views
|
// Collect all document views
|
||||||
DocViews docViews;
|
DocViews docViews;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -35,6 +36,8 @@ DuplicateViewCommand::DuplicateViewCommand()
|
|||||||
bool DuplicateViewCommand::onEnabled(Context* context)
|
bool DuplicateViewCommand::onEnabled(Context* context)
|
||||||
{
|
{
|
||||||
Workspace* workspace = App::instance()->workspace();
|
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();
|
WorkspaceView* view = workspace->activeView();
|
||||||
return (view != nullptr);
|
return (view != nullptr);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -30,7 +31,10 @@ GotoNextTabCommand::GotoNextTabCommand()
|
|||||||
|
|
||||||
bool GotoNextTabCommand::onEnabled(Context* context)
|
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)
|
void GotoNextTabCommand::onExecute(Context* context)
|
||||||
@ -54,7 +58,10 @@ GotoPreviousTabCommand::GotoPreviousTabCommand()
|
|||||||
|
|
||||||
bool GotoPreviousTabCommand::onEnabled(Context* context)
|
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)
|
void GotoPreviousTabCommand::onExecute(Context* context)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user