Guard desktop modal owners and remove obsolete message helpers

This commit is contained in:
evgeny committed 2026-10-28 00:59:00 +01:00
1 parent 8b2b68d383
commit 7556695cc5
3 files changed
+20 -51

No files matched your search

+17 -14
View File
@@ -179,8 +179,7 @@ MainWindow::MainWindow(QWidget *parent, DbManager* db, const QString& cfgPath,
m_cpuLoadTimer = new QTimer(this);
m_cpuLoadTimer->setTimerType(Qt::PreciseTimer);
connect(m_cpuLoadTimer, &QTimer::timeout, this, [this] {
auto* inst = gui_bridge_get_inst();
if (!m_node || !m_node->isRunning() || !inst || !gui_bridge_is_uasync_ready()) {
if (!m_node || !m_node->isRunning() || !gui_bridge_is_uasync_ready()) {
m_cpuLoadPending = false; m_channelList->setCpuLoad(0); return;
}
if (m_cpuLoadPending) return;
@@ -889,6 +888,7 @@ void MainWindow::onRadioCallEvent(const uint8_t* data, int len) {
auto* box = new QMessageBox(QMessageBox::Question, QCoreApplication::translate("ChatGui", "Radio call"),
QCoreApplication::translate("ChatGui", incoming ? "Incoming radio call from %1\nChannel: %2" : "Calling %1 by radio\nChannel: %2")
.arg(name, channelName), QMessageBox::NoButton, this);
box->setTextFormat(Qt::PlainText);
box->setAttribute(Qt::WA_DeleteOnClose);
m_radioCallId = id; m_radioCallWindow = box; m_radioCallAnswered = false;
if (incoming) {
@@ -1291,8 +1291,8 @@ void MainWindow::onTrayActivated(QSystemTrayIcon::ActivationReason reason) {
void MainWindow::showShareInviteDialog(const QString& channelId) {
if (!m_db || !m_db->isOpen()) return;
ShareInviteDialog dlg(channelId, m_db, this);
dlg.exec();
QPointer<ShareInviteDialog> dialog = new ShareInviteDialog(channelId, m_db, this);
auto release = qScopeGuard([&] { delete dialog.data(); }); dialog->exec();
}
void MainWindow::showInviteByLinkDialog(const QString& channelId) {
@@ -1300,8 +1300,8 @@ void MainWindow::showInviteByLinkDialog(const QString& channelId) {
QMessageBox::warning(this, QCoreApplication::translate("ChatGui", "Error"), QCoreApplication::translate("ChatGui", "Node is not running."));
return;
}
InviteByLinkDialog dlg(channelId, m_node, this);
dlg.exec();
QPointer<InviteByLinkDialog> dialog = new InviteByLinkDialog(channelId, m_node, this);
auto release = qScopeGuard([&] { delete dialog.data(); }); dialog->exec();
}
void MainWindow::showJoinDialog() {
@@ -1321,14 +1321,15 @@ void MainWindow::showJoinDialog() {
autoLink = selText;
}
JoinDialog dlg(m_node, m_db, this, autoLink);
dlg.exec();
QPointer<JoinDialog> dialog = new JoinDialog(m_node, m_db, this, autoLink);
auto release = qScopeGuard([&] { delete dialog.data(); }); dialog->exec();
}
void MainWindow::showSettings() {
SettingsDialog dlg(m_cfgPath, m_db, m_node, m_recorder, this);
dlg.exec();
reloadChannels();
QPointer<MainWindow> self(this);
QPointer<SettingsDialog> dialog = new SettingsDialog(m_cfgPath, m_db, m_node, m_recorder, this);
auto release = qScopeGuard([&] { delete dialog.data(); }); dialog->exec();
if (self) reloadChannels();
}
void MainWindow::openVideo(const QString& filePath) {
@@ -1457,10 +1458,12 @@ void MainWindow::onCreateGroupRequested() {
return;
}
CreateGroupDialog dlg(this);
if (dlg.exec() != QDialog::Accepted) return;
QPointer<MainWindow> self(this); QPointer<CreateGroupDialog> dialog = new CreateGroupDialog(this);
auto release = qScopeGuard([&] { delete dialog.data(); });
const int result = dialog->exec();
if (!self || !dialog || result != QDialog::Accepted) return;
QString name = dlg.groupName();
QString name = dialog->groupName();
if (name.isEmpty()) return;
auto* arg = static_cast<chat_create_auto_arg*>(u_calloc(1, sizeof(chat_create_auto_arg)));