mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
default smart pointer type switched to intrusive_ptr
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@337 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -33,19 +33,19 @@ class PackageManager {
|
||||
|
||||
/// Open a package with the specified name (including extension)
|
||||
template <typename T>
|
||||
shared_ptr<T> open(const String& name) {
|
||||
intrusive_ptr<T> open(const String& name) {
|
||||
wxFileName fn(data_directory + _("/") + name);
|
||||
fn.Normalize();
|
||||
String filename = fn.GetFullPath();
|
||||
// Is this package already loaded?
|
||||
PackagedP& p = loaded_packages[filename];
|
||||
shared_ptr<T> typedP = dynamic_pointer_cast<T>(p);
|
||||
intrusive_ptr<T> typedP = dynamic_pointer_cast<T>(p);
|
||||
if (typedP) {
|
||||
typedP->loadFully();
|
||||
return typedP;
|
||||
} else {
|
||||
// not loaded, or loaded with wrong type (i.e. with just_header)
|
||||
p = typedP = new_shared<T>();
|
||||
p = typedP = new_intrusive<T>();
|
||||
typedP->open(filename);
|
||||
return typedP;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user