Fix actionVisitItemPage insersion, and prevent widebar segfault
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
		| @@ -89,7 +89,7 @@ ModFolderPage::ModFolderPage(BaseInstance* inst, std::shared_ptr<ModFolderModel> | |||||||
|         connect(ui->actionUpdateItem, &QAction::triggered, this, &ModFolderPage::updateMods); |         connect(ui->actionUpdateItem, &QAction::triggered, this, &ModFolderPage::updateMods); | ||||||
|  |  | ||||||
|         ui->actionVisitItemPage->setToolTip(tr("Go to mod's home page")); |         ui->actionVisitItemPage->setToolTip(tr("Go to mod's home page")); | ||||||
|         ui->actionsToolbar->insertActionAfter(ui->actionViewFolder, ui->actionVisitItemPage); |         ui->actionsToolbar->addAction(ui->actionVisitItemPage); | ||||||
|         connect(ui->actionVisitItemPage, &QAction::triggered, this, &ModFolderPage::visitModPages); |         connect(ui->actionVisitItemPage, &QAction::triggered, this, &ModFolderPage::visitModPages); | ||||||
|  |  | ||||||
|         auto check_allow_update = [this] { |         auto check_allow_update = [this] { | ||||||
|   | |||||||
| @@ -116,12 +116,21 @@ void WideBar::insertActionAfter(QAction* after, QAction* action) | |||||||
|     if (iter == m_entries.end()) |     if (iter == m_entries.end()) | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
|  |     iter++; | ||||||
|  |     // the action to insert after is present | ||||||
|  |     // however, the element after it isn't valid | ||||||
|  |     if (iter == m_entries.end()) { | ||||||
|  |         // append the action instead of inserting it | ||||||
|  |         addAction(action); | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     BarEntry entry; |     BarEntry entry; | ||||||
|     entry.bar_action = insertWidget((iter + 1)->bar_action, new ActionButton(action, this, m_use_default_action)); |     entry.bar_action = insertWidget(iter->bar_action, new ActionButton(action, this, m_use_default_action)); | ||||||
|     entry.menu_action = action; |     entry.menu_action = action; | ||||||
|     entry.type = BarEntry::Type::Action; |     entry.type = BarEntry::Type::Action; | ||||||
|  |  | ||||||
|     m_entries.insert(iter + 1, entry); |     m_entries.insert(iter, entry); | ||||||
|  |  | ||||||
|     m_menu_state = MenuState::Dirty; |     m_menu_state = MenuState::Dirty; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 TheKodeToad
					TheKodeToad