1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:15:07 +00:00

AK: Add basic Traits for RefPtr

This allows RefPtr to be stored in a HashTable<RefPtr<T>> :^)

It's unfortunate about the const_casts. We'll need to fix HashMap::get
to play nice with non-const Traits<T>::PeekType at some point.
This commit is contained in:
Andreas Kling 2020-02-16 19:36:15 +01:00
parent 9794e18a20
commit a6e69bda71
5 changed files with 13 additions and 6 deletions

View file

@ -74,7 +74,7 @@ void Client::handle(const Messages::ProtocolClient::DownloadFinished& message)
void Client::handle(const Messages::ProtocolClient::DownloadProgress& message)
{
if (auto download = m_downloads.get(message.download_id()).value_or(nullptr)) {
if (auto download = const_cast<Download*>(m_downloads.get(message.download_id()).value_or(nullptr))) {
download->did_progress({}, message.total_size(), message.downloaded_size());
}
}