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 53509f2
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 @@ -1308,6 +1302,12 @@ void MainWindow::onBrowserCreated(ClipboardBrowser *browser)
const int index = ui->tabWidget->currentIndex();
tabChanged(index, index);
}

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

void MainWindow::onBrowserDestroyed(ClipboardBrowserPlaceholder *placeholder)
Expand Down

0 comments on commit 53509f2

Please sign in to comment.