From 15329187b9715fbd47e4403d4da9e29cd3da1644 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Thu, 17 Nov 2011 23:14:45 +0100 Subject: [PATCH] Unrefing a device that has never been ref'd will also destroy it. --- sortix/device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sortix/device.cpp b/sortix/device.cpp index 6f9fb277..65b0961b 100644 --- a/sortix/device.cpp +++ b/sortix/device.cpp @@ -40,7 +40,7 @@ namespace Sortix void Device::Unref() { - if ( --refcount == 0 ) { delete this; } + if ( --refcount == 0 || refcount == SIZE_MAX ) { delete this; } } void Device::Refer()