Skip to content

Commit d2d0aab

Browse files
committed
Fixes for emscripten
1 parent 8076487 commit d2d0aab

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

modules/yup_data_model/undo/yup_UndoManager.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ bool UndoManager::perform (UndoableAction::Ptr action)
135135
if (! isEnabled())
136136
return false;
137137

138+
// Ensure timer is started if MessageManager is now available and we're enabled
139+
if (actionGroupThreshold > RelativeTime()
140+
&& ! isTimerRunning()
141+
&& MessageManager::getInstanceWithoutCreating() != nullptr)
142+
{
143+
startTimer (static_cast<int> (actionGroupThreshold.inMilliseconds()));
144+
}
145+
138146
if (action->perform (UndoableActionState::Redo))
139147
{
140148
if (currentTransaction == nullptr)
@@ -248,7 +256,8 @@ void UndoManager::setEnabled (bool shouldBeEnabled)
248256

249257
if (shouldBeEnabled)
250258
{
251-
if (actionGroupThreshold > RelativeTime())
259+
// Only start timer if MessageManager exists (may not be available during early initialization)
260+
if (actionGroupThreshold > RelativeTime() && MessageManager::getInstanceWithoutCreating() != nullptr)
252261
startTimer (static_cast<int> (actionGroupThreshold.inMilliseconds()));
253262
}
254263
else

0 commit comments

Comments
 (0)