Gui: simplify singleton of PropertyItemFactory

This commit is contained in:
wmayer
2024-04-23 10:28:50 +02:00
committed by wwmayer
parent 1c39969061
commit 68bfbd0707
2 changed files with 2 additions and 15 deletions

View File

@@ -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

View File

@@ -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;
};