diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-09-03 19:11:51 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-03 23:20:23 +0200 |
commit | d7b6cc6421c48185f4dfafb24d2b093b86305860 (patch) | |
tree | 7e5ace9318b73d4efe095c43605cd514db1cccaa /Userland/Libraries/LibIMAP/Client.h | |
parent | bad23e3f8cc9c66d818ddb2f7bbe7bddce5c09e2 (diff) | |
download | serenity-d7b6cc6421c48185f4dfafb24d2b093b86305860.zip |
Everywhere: Prevent risky implicit casts of (Nonnull)RefPtr
Our existing implementation did not check the element type of the other
pointer in the constructors and move assignment operators. This meant
that some operations that would require explicit casting on raw pointers
were done implicitly, such as:
- downcasting a base class to a derived class (e.g. `Kernel::Inode` =>
`Kernel::ProcFSDirectoryInode` in Kernel/ProcFS.cpp),
- casting to an unrelated type (e.g. `Promise<bool>` => `Promise<Empty>`
in LibIMAP/Client.cpp)
This, of course, allows gross violations of the type system, and makes
the need to type-check less obvious before downcasting. Luckily, while
adding the `static_ptr_cast`s, only two truly incorrect usages were
found; in the other instances, our casts just needed to be made
explicit.
Diffstat (limited to 'Userland/Libraries/LibIMAP/Client.h')
-rw-r--r-- | Userland/Libraries/LibIMAP/Client.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibIMAP/Client.h b/Userland/Libraries/LibIMAP/Client.h index 3fb9095dbd..cea34fe37c 100644 --- a/Userland/Libraries/LibIMAP/Client.h +++ b/Userland/Libraries/LibIMAP/Client.h @@ -69,7 +69,7 @@ private: // Not yet sent Vector<Command> m_command_queue {}; - RefPtr<Promise<bool>> m_connect_pending {}; + RefPtr<Promise<Empty>> m_connect_pending {}; ByteBuffer m_buffer; Parser m_parser; |