Fix windows build

No idea, why apply visitor doesn't work with temporaries?
This commit is contained in:
Nicolas Werner 2019-11-12 15:10:59 +00:00
parent c424e397b0
commit 001c94865c
3 changed files with 7 additions and 5 deletions

View file

@ -488,7 +488,7 @@ RoomSettings::retrieveRoomInfo()
usesEncryption_ = cache::client()->isRoomEncrypted(room_id_.toStdString()); usesEncryption_ = cache::client()->isRoomEncrypted(room_id_.toStdString());
info_ = cache::client()->singleRoomInfo(room_id_.toStdString()); info_ = cache::client()->singleRoomInfo(room_id_.toStdString());
setAvatar(); setAvatar();
} catch (const lmdb::error &e) { } catch (const lmdb::error &) {
nhlog::db()->warn("failed to retrieve room info from cache: {}", nhlog::db()->warn("failed to retrieve room info from cache: {}",
room_id_.toStdString()); room_id_.toStdString());
} }

View file

@ -438,16 +438,17 @@ TimelineModel::data(const QModelIndex &index, int role) const
boost::apply_visitor([](const auto &e) -> QString { return senderId(e); }, event); boost::apply_visitor([](const auto &e) -> QString { return senderId(e); }, event);
for (int r = index.row() - 1; r > 0; r--) { for (int r = index.row() - 1; r > 0; r--) {
auto tempEv = events.value(eventOrder[r]);
QDateTime prevDate = boost::apply_visitor( QDateTime prevDate = boost::apply_visitor(
[](const auto &e) -> QDateTime { return eventTimestamp(e); }, [](const auto &e) -> QDateTime { return eventTimestamp(e); },
events.value(eventOrder[r])); tempEv);
prevDate.setTime(QTime()); prevDate.setTime(QTime());
if (prevDate != date) if (prevDate != date)
return QString("%2 %1").arg(date.toMSecsSinceEpoch()).arg(userId); return QString("%2 %1").arg(date.toMSecsSinceEpoch()).arg(userId);
QString prevUserId = QString prevUserId =
boost::apply_visitor([](const auto &e) -> QString { return senderId(e); }, boost::apply_visitor([](const auto &e) -> QString { return senderId(e); },
events.value(eventOrder[r])); tempEv);
if (userId != prevUserId) if (userId != prevUserId)
break; break;
} }
@ -1313,7 +1314,8 @@ TimelineModel::processOnePendingMessage()
QString txn_id_qstr = pending.first(); QString txn_id_qstr = pending.first();
boost::apply_visitor(SendMessageVisitor{txn_id_qstr, this}, events.value(txn_id_qstr)); auto event = events.value(txn_id_qstr);
boost::apply_visitor(SendMessageVisitor{txn_id_qstr, this}, event);
} }
void void

View file

@ -200,7 +200,7 @@ TimelineViewManager::saveMedia(QString mxcUrl,
if (!file.open(QIODevice::WriteOnly)) if (!file.open(QIODevice::WriteOnly))
return; return;
file.write(QByteArray(data.data(), data.size())); file.write(QByteArray(data.data(), (int)data.size()));
file.close(); file.close();
} catch (const std::exception &e) { } catch (const std::exception &e) {
nhlog::ui()->warn("Error while saving file to: {}", e.what()); nhlog::ui()->warn("Error while saving file to: {}", e.what());