Showing the changes to interface/src/MenuScriptingInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -11,26 +11,9 @@ · 10 unmodified lines | ||
| 11 | 11 | #include "MenuScriptingInterface.h" |
| 12 | 12 | |
| 13 | 13 | |
| 14 | −MenuScriptingInterface* MenuScriptingInterface::_instance = NULL; | |
| 15 | −QMutex MenuScriptingInterface::_instanceMutex; | |
| 16 | − | |
| 17 | 14 | MenuScriptingInterface* MenuScriptingInterface::getInstance() { |
| 18 | − // lock the menu instance mutex to make sure we don't race and create two menus and crash | |
| 19 | − _instanceMutex.lock(); | |
| 20 | − if (!_instance) { | |
| 21 | − _instance = new MenuScriptingInterface(); | |
| 22 | − } | |
| 23 | − _instanceMutex.unlock(); | |
| 24 | − return _instance; | |
| 25 | −} | |
| 26 | − | |
| 27 | −void MenuScriptingInterface::deleteLaterIfExists() { | |
| 28 | − _instanceMutex.lock(); | |
| 29 | − if (_instance) { | |
| 30 | − _instance->deleteLater(); | |
| 31 | − _instance = NULL; | |
| 32 | − } | |
| 33 | − _instanceMutex.unlock(); | |
| 15 | + static MenuScriptingInterface sharedInstance; | |
| 16 | + return &sharedInstance; | |
| 34 | 17 | } |
| 35 | 18 | |
| 36 | 19 | void MenuScriptingInterface::menuItemTriggered() { |