diff --git a/Kernel/FileSystem/File.cpp b/Kernel/FileSystem/File.cpp index 0551f1a390..91311f639e 100644 --- a/Kernel/FileSystem/File.cpp +++ b/Kernel/FileSystem/File.cpp @@ -20,6 +20,14 @@ File::~File() { } +bool File::unref() const +{ + if (deref_base()) + return false; + delete this; + return true; +} + KResultOr> File::open(int options) { auto description = FileDescription::create(*this); diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index cd29de6e5c..2914d4c088 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -71,9 +71,10 @@ public: // - Should create a Region in the Process and return it if successful. class File - : public RefCounted + : public RefCountedBase , public Weakable { public: + virtual bool unref() const; virtual ~File(); virtual KResultOr> open(int options);