summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/File.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-16 20:58:23 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-17 01:21:47 +0200
commit641083f3b89b7a7a5928b0eedb1a236949dcdc42 (patch)
tree67d548c82fab87a8895b7edad04b8b46e00826d2 /Kernel/FileSystem/File.h
parentfc0cd8317a22e982cbf1ba90c18ca72299660eb8 (diff)
downloadserenity-641083f3b89b7a7a5928b0eedb1a236949dcdc42.zip
Kernel: Customize File::unref() and make it virtual
Make File inherit from RefCountedBase and provide a custom unref() implementation. This will allow subclasses that participate in lists to remove themselves in a safe way when being destroyed.
Diffstat (limited to 'Kernel/FileSystem/File.h')
-rw-r--r--Kernel/FileSystem/File.h3
1 files changed, 2 insertions, 1 deletions
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<File>
+ : public RefCountedBase
, public Weakable<File> {
public:
+ virtual bool unref() const;
virtual ~File();
virtual KResultOr<NonnullRefPtr<FileDescription>> open(int options);