Skip to content

Commit

Permalink
Fix crash after handling onItemsLoaded()
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Jan 3, 2024
1 parent 5215285 commit 2bb3629
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,12 +1279,6 @@ void MainWindow::onBrowserCreated(ClipboardBrowser *browser)
connect( browser, &ClipboardBrowser::itemWidgetCreated,
this, &MainWindow::onItemWidgetCreated );

if (isScriptOverridden(ScriptOverrides::OnItemsLoaded)) {
runEventHandlerScript(
QStringLiteral("onItemsLoaded()"),
createDataMap(mimeCurrentTab, browser->tabName()));
}

connect( browser, &ClipboardBrowser::itemsAboutToBeRemoved,
browser, [this, browser](const QModelIndex &, int first, int last) {
if (isScriptOverridden(ScriptOverrides::OnItemsRemoved))
Expand All @@ -1304,6 +1298,12 @@ void MainWindow::onBrowserCreated(ClipboardBrowser *browser)
}
} );

if (isScriptOverridden(ScriptOverrides::OnItemsLoaded)) {
runEventHandlerScript(
QStringLiteral("onItemsLoaded()"),
createDataMap(mimeCurrentTab, browser->tabName()));
}

if (browserOrNull() == browser) {
const int index = ui->tabWidget->currentIndex();
tabChanged(index, index);
Expand Down

0 comments on commit 2bb3629

Please sign in to comment.