mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Profiles model is now a singleton, to prevent the agressive garbage collecting to break stuff
CURA-2826
This commit is contained in:
parent
4a5d7cbc73
commit
1aa71d6171
3 changed files with 17 additions and 2 deletions
|
|
@ -25,6 +25,21 @@ class ProfilesModel(InstanceContainersModel):
|
|||
Application.getInstance().getMachineManager().activeStackChanged.connect(self._update)
|
||||
Application.getInstance().getMachineManager().activeMaterialChanged.connect(self._update)
|
||||
|
||||
# Factory function, used by QML
|
||||
@staticmethod
|
||||
def createProfilesModel(engine, js_engine):
|
||||
return ProfilesModel.getInstance()
|
||||
|
||||
## Get the singleton instance for this class.
|
||||
@classmethod
|
||||
def getInstance(cls):
|
||||
# Note: Explicit use of class name to prevent issues with inheritance.
|
||||
if ProfilesModel.__instance is None:
|
||||
ProfilesModel.__instance = cls()
|
||||
return ProfilesModel.__instance
|
||||
|
||||
__instance = None
|
||||
|
||||
## Fetch the list of containers to display.
|
||||
#
|
||||
# See UM.Settings.Models.InstanceContainersModel._fetchInstanceContainers().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue