Fix potential crash when opening separate rooms

imageformats
Nicolas Werner 3 years ago
parent 87070289fd
commit 9910244f6b
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 5
      src/timeline/RoomlistModel.h

@ -11,6 +11,7 @@
#include <QSharedPointer>
#include <QSortFilterProxyModel>
#include <QString>
#include <QQmlEngine>
#include <set>
#include <mtx/responses/sync.hpp>
@ -184,7 +185,9 @@ public slots:
void resetCurrentRoom() { roomlistmodel->resetCurrentRoom(); }
TimelineModel *getRoomById(const QString &id) const
{
return roomlistmodel->getRoomById(id).data();
auto r = roomlistmodel->getRoomById(id).data();
QQmlEngine::setObjectOwnership(r, QQmlEngine::CppOwnership);
return r;
}
RoomPreview getRoomPreviewById(QString roomid) const
{

Loading…
Cancel
Save