X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fgarbage.C;h=027754df5224871732a63f06617187fe19833508;hp=8b15d8b68cb148933119b32e8d5b040a56f42a86;hb=a19a685a46ddc630010788707d9e5b9d2342af46;hpb=e13e0a987ad66b8274fcbaddc71eac583ea80bea diff --git a/cinelerra-5.1/cinelerra/garbage.C b/cinelerra-5.1/cinelerra/garbage.C index 8b15d8b6..027754df 100644 --- a/cinelerra-5.1/cinelerra/garbage.C +++ b/cinelerra-5.1/cinelerra/garbage.C @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * */ #include "bcsignals.h" @@ -41,8 +41,8 @@ Garbage::Garbage(const char *title) Garbage::~Garbage() { if(!deleted) - printf("Garbage::~Garbage: title=%s users=%d was not deleted by Garbage::remove_user\n", - title, + printf("Garbage::~Garbage: title=%s users=%d was not deleted by Garbage::remove_user\n", + title, users); delete [] title; delete lock; @@ -58,7 +58,8 @@ void Garbage::add_user() int Garbage::remove_user() { - if(!(void *)this) return 0; + void *This = this; + if(!This) return 0; //printf("Garbage::remove_user %d lock=%p users=%d\n", __LINE__, lock, users); if(users <= 0) { @@ -95,39 +96,39 @@ int Garbage::remove_user() // { // lock = new Mutex("Garbage::lock", 1); // } -// -// +// +// // Garbage::~Garbage() // { // delete lock; // } -// +// // // void Garbage::add_object(GarbageObject *ptr) // // { // // lock->lock("Garbage::add_object"); // // objects.append(ptr); // // lock->unlock(); // // } -// +// // void Garbage::delete_object(GarbageObject *ptr) // { // if(!ptr) return; -// +// // Garbage *garbage = Garbage::garbage; // garbage->lock->lock("Garbage::delete_object"); // ptr->users--; -// +// // if(ptr->users <= 0) // { // ptr->deleted = 1; // delete ptr; -// +// // // Remove expired objects here // // remove_expired(); // } // garbage->lock->unlock(); // } -// +// // void Garbage::remove_expired() // { // Garbage *garbage = Garbage::garbage; @@ -139,7 +140,7 @@ int Garbage::remove_user() // // Must remove pointer to prevent recursive deletion of the same object. // // But i is still invalid. // garbage->objects.remove_number(i); -// +// // delete ptr; // i--; // }