Skip to content

Commit

Permalink
Don't send dataChanged for newly added sessions
Browse files Browse the repository at this point in the history
In the session listing model. This ends up confusing QSortFilterProxy
somehow, causing it to potentially run into a crash.
  • Loading branch information
askmeaboutlo0m committed Aug 7, 2024
1 parent a32134a commit 0807575
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Unreleased Version 2.2.2-pre
* Fix: Use more accurate timers for performance profiles if the platform supports it.
* Fix: Don't try to update the roles list before becoming an operator, which could lead to a crash. Thanks Bluestrings for reporting.
* Fix: Don't update sessions that were just added to the session browser, since that can lead to a crash because of what is probably a bug in Qt's filtering and sorting. Thanks Bluestrings for reporting.

2024-08-04 Version 2.2.2-beta.2
* Feature: Allow choosing a different cursor for erase and alpha locked brushes. Thanks Hipofiz and Rylan for suggesting.
Expand Down
13 changes: 9 additions & 4 deletions src/libclient/net/sessionlistingmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "libclient/net/sessionlistingmodel.h"
#include "libclient/net/loginsessions.h"
#include "libclient/parentalcontrols/parentalcontrols.h"
#include "libshared/util/qtcompat.h"
#include <QFont>
#include <QIcon>
#include <QPalette>
Expand Down Expand Up @@ -501,10 +502,14 @@ void SessionListingModel::setList(
}

emit dataChanged(createIndex(i, 0), createIndex(i, 0));
emit dataChanged(
createIndex(0, 0, quintptr(i + 1)),
createIndex(
sessions.size() - 1, ColumnCount - 1, quintptr(i + 1)));

compat::sizetype changedSize = qMin(oldSize, sessions.size());
if(changedSize > 0) {
emit dataChanged(
createIndex(0, 0, quintptr(i + 1)),
createIndex(
changedSize - 1, ColumnCount - 1, quintptr(i + 1)));
}
return;
}
}
Expand Down

0 comments on commit 0807575

Please sign in to comment.