Skip to content

Commit

Permalink
Gui: simplify singleton of PropertyItemFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Apr 23, 2024
1 parent 1c39969 commit 68bfbd0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
14 changes: 2 additions & 12 deletions src/Gui/propertyeditor/PropertyItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/Gui/propertyeditor/PropertyItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 68bfbd0

Please sign in to comment.