From 9d034785de89187f2722c444740e3333f4c23926 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Wed, 29 Dec 2021 14:13:12 +0200 Subject: [PATCH] Kernel: Make File::unref virtual This is required for SlavePTY's custom unref handler to function correctly, as otherwise a SlavePTY held in a File RefPtr would call the base's (RefCounted<>) unref method instead of SlavePTY's version. --- Kernel/FileSystem/File.h | 1 + Kernel/TTY/SlavePTY.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index b4f4124a8a..c3396fc74e 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -74,6 +74,7 @@ class File : public RefCounted , public Weakable { public: + virtual bool unref() const { return RefCounted::unref(); } virtual void will_be_destroyed() { } virtual ~File(); diff --git a/Kernel/TTY/SlavePTY.h b/Kernel/TTY/SlavePTY.h index 190408703f..4be7373e77 100644 --- a/Kernel/TTY/SlavePTY.h +++ b/Kernel/TTY/SlavePTY.h @@ -15,7 +15,7 @@ class MasterPTY; class SlavePTY final : public TTY { public: - bool unref() const; + virtual bool unref() const override; virtual ~SlavePTY() override; void on_master_write(const UserOrKernelBuffer&, size_t);