Gui: simplify singleton of PropertyItemFactory
This commit is contained in:
@@ -82,20 +82,10 @@ float fromPercent(int value)
|
||||
|
||||
}
|
||||
|
||||
Gui::PropertyEditor::PropertyItemFactory* Gui::PropertyEditor::PropertyItemFactory::_singleton = nullptr;
|
||||
|
||||
PropertyItemFactory& PropertyItemFactory::instance()
|
||||
{
|
||||
if (!_singleton) {
|
||||
_singleton = new PropertyItemFactory;
|
||||
}
|
||||
return *_singleton;
|
||||
}
|
||||
|
||||
void PropertyItemFactory::destruct ()
|
||||
{
|
||||
delete _singleton;
|
||||
_singleton = nullptr;
|
||||
static PropertyItemFactory inst;
|
||||
return inst;
|
||||
}
|
||||
|
||||
PropertyItem* PropertyItemFactory::createPropertyItem (const char* sName) const
|
||||
|
||||
@@ -90,13 +90,10 @@ class GuiExport PropertyItemFactory : public Base::Factory
|
||||
{
|
||||
public:
|
||||
static PropertyItemFactory& instance();
|
||||
static void destruct ();
|
||||
|
||||
PropertyItem* createPropertyItem (const char* sName) const;
|
||||
|
||||
private:
|
||||
static PropertyItemFactory* _singleton;
|
||||
|
||||
PropertyItemFactory() = default;
|
||||
~PropertyItemFactory() override = default;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user