Changeset 10553
- Timestamp:
- Aug 28, 2015, 10:35:51 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/module/Plugin.cc
r10552 r10553 52 52 void Plugin::load() 53 53 { 54 if (this->referenceCounter_ == 0) 54 this->referenceCounter_++; 55 if (this->referenceCounter_ == 1) // increased from 0 to 1 -> load plugin 55 56 { 56 57 orxout(internal_info) << "Loading plugin " << this->name_ << "..." << endl; … … 59 60 } 60 61 else 61 { 62 orxout(internal_info) << "Plugin " << this->name_ << " is already referenced" << endl; 63 } 64 65 this->referenceCounter_++; 62 orxout(internal_info) << "Increased reference count for plugin " << this->name_ << " to " << this->referenceCounter_ << endl; 66 63 } 67 64 68 65 void Plugin::unload() 69 66 { 67 if (this->referenceCounter_ == 0) 68 { 69 orxout(internal_warning) << "Tried to dereference plugin " << this->name_ << " more often than it was referenced" << endl; 70 return; 71 } 72 70 73 this->referenceCounter_--; 71 if (this->referenceCounter_ == 0) 74 if (this->referenceCounter_ == 0) // reduced from 1 to 0 -> load plugin 72 75 { 73 76 orxout(internal_info) << "Unloading plugin " << this->name_ << "..." << endl; … … 76 79 this->moduleInstance_ = NULL; 77 80 } 78 else if (this->referenceCounter_ > 0)79 {80 orxout(internal_info) << "Plugin " << this->name_ << " is still referenced" << endl;81 }82 81 else 83 { 84 orxout(internal_warning) << "Plugin " << this->name_ << " was dereferenced more often than it was reference" << endl; 85 this->referenceCounter_ = 0; 86 } 82 orxout(internal_info) << "Reduced reference count for plugin " << this->name_ << " to " << this->referenceCounter_ << endl; 87 83 } 88 84 }
Note: See TracChangeset
for help on using the changeset viewer.