From: Mathias Froehlich Date: Sat, 1 Dec 2012 06:58:38 +0000 (+0100) Subject: SharedPtr: Avoid double dereference when calling clear(). X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e5afc6f029ab794d08b28a69edd2523dead8d7d7;p=simgear.git SharedPtr: Avoid double dereference when calling clear(). --- diff --git a/simgear/structure/SGSharedPtr.hxx b/simgear/structure/SGSharedPtr.hxx index c815a2fa..b8553b06 100644 --- a/simgear/structure/SGSharedPtr.hxx +++ b/simgear/structure/SGSharedPtr.hxx @@ -1,6 +1,6 @@ /* -*-c++-*- * - * Copyright (C) 2005-2009 Mathias Froehlich + * Copyright (C) 2005-2012 Mathias Froehlich * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -104,7 +104,7 @@ private: void get(const T* p) const { T::get(p); } void put(void) - { if (!T::put(_ptr)) { delete _ptr; _ptr = 0; } } + { if (!T::put(_ptr)) delete _ptr; _ptr = 0; } // The reference itself. T* _ptr;