summaryrefslogtreecommitdiff
path: root/src/modinfodialog.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-06-25 17:44:41 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-07-02 10:10:19 -0400
commitfa20f81b46c3f8c89fcbbdff6e5da0225c707358 (patch)
treed02df7f08ba1fdac3fb9d6b699621cfc69638944 /src/modinfodialog.cpp
parent65b3eb24fc5e3e1033d583a24cb51a19b0cfac2c (diff)
replaced reportError() calls by qCritical() because they can come from a thread, which hangs the ui
categories and notes will update the tab color when changing fixed rare crash when reordering tabs while loading a mod
Diffstat (limited to 'src/modinfodialog.cpp')
-rw-r--r--src/modinfodialog.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp
index f11fa6f3..7696023f 100644
--- a/src/modinfodialog.cpp
+++ b/src/modinfodialog.cpp
@@ -124,7 +124,8 @@ ModInfoDialog::ModInfoDialog(
MainWindow* mw, OrganizerCore* core, PluginContainer* plugin) :
TutorableDialog("ModInfoDialog", mw),
ui(new Ui::ModInfoDialog), m_mainWindow(mw),
- m_core(core), m_plugin(plugin), m_initialTab(ETabs(-1))
+ m_core(core), m_plugin(plugin), m_initialTab(ETabs(-1)),
+ m_arrangingTabs(false)
{
ui->setupUi(this);
@@ -156,6 +157,10 @@ ModInfoDialog::ModInfoDialog(
setMod(name);
update();
});
+
+ connect(
+ tabInfo.tab.get(), &ModInfoDialogTab::hasDataChanged,
+ [&]{ setTabsColors(); });
}
connect(ui->tabWidget, &QTabWidget::currentChanged, [&]{ onTabChanged(); });
@@ -269,6 +274,8 @@ void ModInfoDialog::update(bool firstTime)
void ModInfoDialog::setTabsVisibility(bool firstTime)
{
+ QScopedValueRollback arrangingTabs(m_arrangingTabs, true);
+
std::vector<bool> visibility(m_tabs.size());
bool changed = false;
@@ -374,7 +381,7 @@ void ModInfoDialog::setTabsColors()
for (const auto& tabInfo : m_tabs) {
const auto c = tabInfo.tab->hasData() ?
QColor::Invalid :
- ui->tabWidget->palette().color(QPalette::Disabled, QPalette::WindowText);
+ m_mainWindow->palette().color(QPalette::Disabled, QPalette::WindowText);
ui->tabWidget->tabBar()->setTabTextColor(tabInfo.realPos, c);
}
@@ -564,6 +571,13 @@ void ModInfoDialog::on_closeButton_clicked()
void ModInfoDialog::onTabChanged()
{
+ if (m_arrangingTabs) {
+ // this can be fired while re-arranging tabs, which happens before mods
+ // are given to tabs, and might trigger first activation, which breaks all
+ // sorts of things
+ return;
+ }
+
if (auto* tabInfo=currentTab()) {
tabInfo->tab->activated();
}