Skip to content

Commit a8f3b3a

Browse files
committed
TerminalPlugin: fix a crash
When changing the editor font, the callback for changing the terminal font was triggered. This is a design problem in qmdiConfig - each plugin saves its data in a global state. I can workaround it for now.
1 parent 58ec489 commit a8f3b3a

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/plugins/Terminal/TerminalPlugin.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ TerminalPlugin::TerminalPlugin() {
7171
.build());
7272
config.configItems.push_back(qmdiConfigItem::Builder()
7373
.setDisplayName(tr("Display font"))
74-
.setKey(Config::FontKey)
74+
.setKey(Config::TerminalFontKey)
7575
.setType(qmdiConfigItem::Font)
7676
.setDefaultValue(monospacedFont)
7777
.setValue(monospacedFont)
@@ -150,11 +150,11 @@ TerminalPlugin::TerminalPlugin() {
150150
promptPreviewLabel = label;
151151
promptPreviewLabel->setAutoFillBackground(true);
152152
promptPreviewLabel->setFrameStyle(QFrame::Panel);
153-
promptPreviewLabel->setFont(getConfig().getFont());
153+
promptPreviewLabel->setFont(getConfig().getTerminalFont());
154154
updateTerminalPreview();
155155
}
156156

157-
if (item.key == Config::FontKey) {
157+
if (item.key == Config::TerminalFontKey) {
158158
auto f = qobject_cast<FontWidget *>(widget);
159159
connect(f, &FontWidget::fontUpdated, f, [this, f]() {
160160
promptPreviewLabel->setFont(f->font());
@@ -215,7 +215,7 @@ void TerminalPlugin::configurationHasBeenModified() {
215215
getConfig().setThemeFile(tempConfig.themeFile);
216216

217217
consoleConfig.setDefaults();
218-
consoleConfig.font = getConfig().getFont();
218+
consoleConfig.font = getConfig().getTerminalFont();
219219
consoleConfig.tripleClickSelectsLine = getConfig().getTrippleClickClick();
220220
consoleConfig.copyOnSelect = getConfig().getCopyOnSelect();
221221
consoleConfig.pasteOnMiddleClick = getConfig().getPasteOnMiddleClick();

src/plugins/Terminal/TerminalPlugin.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class QLabel;
1818

1919
class TerminalPlugin : public IPlugin {
2020
struct Config {
21-
CONFIG_DEFINE(Font, QString)
21+
CONFIG_DEFINE(TerminalFont, QString)
2222
CONFIG_DEFINE(ThemeFile, QString)
2323
CONFIG_DEFINE(ThemeFileChoose, QString)
2424
CONFIG_DEFINE(PromptPreview, QString)

0 commit comments

Comments
 (0)