diff --git a/include/GUIManager/GUIManager.h b/include/GUIManager/GUIManager.h index ef1a337..0e2c5a9 100644 --- a/include/GUIManager/GUIManager.h +++ b/include/GUIManager/GUIManager.h @@ -158,6 +158,8 @@ public: void DeleteWidgetOnUpdate(const std::string& name); void DeleteWidgetGroupOnUpdate(const std::string& groupName); + void DeleteWidgetLaterOnUpdate(const std::string& name); + void DeleteWidgetGroupLaterOnUpdate(const std::string& groupName); void Update(cardinal dt); void Draw(); diff --git a/include/Utils/ThreadUtils.h b/include/Utils/ThreadUtils.h index 1048011..69900d0 100644 --- a/include/Utils/ThreadUtils.h +++ b/include/Utils/ThreadUtils.h @@ -37,6 +37,7 @@ namespace SE void TryUpdateMainThreadId(); void PerformInMainThreadAsync(boost::function f); + void PerformInMainThreadAsyncLater(boost::function f); template RETURNTYPE PerformInMainThread(boost::function f); diff --git a/src/GUIManager/GUIManager.cpp b/src/GUIManager/GUIManager.cpp index b0d4d34..a3d5b34 100644 --- a/src/GUIManager/GUIManager.cpp +++ b/src/GUIManager/GUIManager.cpp @@ -90,16 +90,29 @@ void TGUIManager::DeleteWidgetGroup(std::string groupName) void TGUIManager::DeleteWidgetOnUpdate(const std::string& name) { + //PerformInMainThreadAsyncLater(boost::bind(&TGUIManager::DeleteWidget, this, name)); PerformInMainThreadAsync(boost::bind(&TGUIManager::DeleteWidget, this, name)); - //PostUpdateSignal.connect(boost::bind(&TGUIManager::DeleteWidget, this, name)); + } void TGUIManager::DeleteWidgetGroupOnUpdate(const std::string& groupName) { + //PerformInMainThreadAsyncLater(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName)); PerformInMainThreadAsync(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName)); - //PostUpdateSignal.connect(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName)); + } +void TGUIManager::DeleteWidgetLaterOnUpdate(const std::string& name) +{ + PerformInMainThreadAsyncLater(boost::bind(&TGUIManager::DeleteWidget, this, name)); +} + +void TGUIManager::DeleteWidgetGroupLaterOnUpdate(const std::string& groupName) +{ + PerformInMainThreadAsyncLater(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName)); +} + + void TGUIManager::AddWidgetTransformTask(TWidgetTransformTask widgetTransformTask) diff --git a/src/Utils/ThreadUtils.cpp b/src/Utils/ThreadUtils.cpp index 2ff9f6a..497694e 100644 --- a/src/Utils/ThreadUtils.cpp +++ b/src/Utils/ThreadUtils.cpp @@ -46,8 +46,11 @@ namespace SE } + } - + void PerformInMainThreadAsyncLater(boost::function f) + { + ST::MainThreadIoService.post(f); } #endif