Skip to content

Commit

Permalink
Fixed regression in dialog registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jun 9, 2024
1 parent 17086a4 commit a30a8f8
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/psiaccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,18 +805,30 @@ public slots:

void dialogRegister(QWidget *w, const Jid &jid)
{
item_dialog2 *i;
if (connect(w, &QWidget::destroyed, this, &Private::forceDialogUnregister, Qt::UniqueConnection)) {
item_dialog2 *i = new item_dialog2;
i->widget = w;
i->jid = jid;
i = new item_dialog2;
i->widget = w;
dialogList.append(i);
// qDebug("registerd: %s for jid=%s", qPrintable(w->objectName()), qPrintable(jid.full()));
} else {
auto it = std::ranges::find_if(dialogList, [w](auto const &v) { return v->widget == w; });
if (it == dialogList.end()) {
qWarning("dialog registration inconsistency: %s jid=%s", qPrintable(w->objectName()),
qPrintable(jid.full()));
return;
}
i = *it;
// qDebug("jid updated: %s for jid=%s", qPrintable(w->objectName()), qPrintable(jid.full()));
}
i->jid = jid;
}

void dialogUnregister(QWidget *w)
{
for (item_dialog2 *i : std::as_const(dialogList)) {
if (i->widget == w) {
disconnect(w, &QWidget::destroyed, this, &Private::forceDialogUnregister);
dialogList.removeAll(i);
delete i;
return;
Expand Down

0 comments on commit a30a8f8

Please sign in to comment.