Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gui: fix crash in PythonCommand::isChecked() #13440

Merged
merged 1 commit into from Apr 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Gui/Command.cpp
Expand Up @@ -67,7 +67,7 @@
#include "ShortcutManager.h"


FC_LOG_LEVEL_INIT("Command", true, true)

Check warning on line 70 in src/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

non-POD static (LogLevel) [-Wclazy-non-pod-global-static]

Check warning on line 70 in src/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

variable '_s_fclvl' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

using Base::Interpreter;
using namespace Gui;
Expand Down Expand Up @@ -133,7 +133,7 @@
*/

// list of modules already loaded by a command (not issue again for macro cleanness)
std::set<std::string> alreadyLoadedModule;

Check warning on line 136 in src/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

variable 'alreadyLoadedModule' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

class StringCache {
public:
Expand All @@ -145,7 +145,7 @@
}
};

CommandBase::CommandBase(const char* sMenu, const char* sToolTip, const char* sWhat,

Check warning on line 148 in src/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

2 adjacent parameters of 'CommandBase' of similar type ('const char *') are easily swapped by mistake [bugprone-easily-swappable-parameters]

Check warning on line 148 in src/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

4 adjacent parameters of 'CommandBase' of similar type ('const char *') are easily swapped by mistake [bugprone-easily-swappable-parameters]
const char* sStatus, const char* sPixmap, const char* sAcc)
: sMenuText(sMenu)
, sToolTipText(sToolTip)
Expand Down Expand Up @@ -1462,6 +1462,7 @@

bool PythonCommand::isChecked() const
{
Base::PyGILStateLocker lock;
PyObject* item = PyDict_GetItemString(_pcPyResourceDict,"Checkable");
if (!item) {
throw Base::ValueError("PythonCommand::isChecked(): Method GetResources() of the Python "
Expand Down