Skip to content

Commit 9ff2d45

Browse files
committed
Update logic for setting initial state (#3044)
Signed-off-by: Ian Chen <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]> (cherry picked from commit 6529f3f) Signed-off-by: Ian Chen <[email protected]> # Conflicts: # src/gui/GuiRunner.cc
1 parent 3f8d77b commit 9ff2d45

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/gui/GuiRunner.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class gz::sim::GuiRunner::Implementation
7474
public: std::thread updateThread;
7575

7676
/// \brief True if the initial state has been received and processed.
77-
public: bool receivedInitialState{false};
77+
public: std::atomic<bool> receivedInitialState{false};
7878

7979
/// \brief Name of WorldControl service
8080
public: std::string controlService;
@@ -264,7 +264,6 @@ void GuiRunner::OnStateAsyncService(const msgs::SerializedStepMap &_res)
264264
// variables.
265265
QMetaObject::invokeMethod(this, "OnStateQt", Qt::QueuedConnection,
266266
Q_ARG(msgs::SerializedStepMap, _res));
267-
this->dataPtr->receivedInitialState = true;
268267

269268
// todo(anyone) store reqSrv string in a member variable and use it here
270269
// and in RequestState()
@@ -302,6 +301,8 @@ void GuiRunner::OnStateQt(const msgs::SerializedStepMap &_msg)
302301
// Update all plugins
303302
this->dataPtr->updateInfo = convert<UpdateInfo>(_msg.stats());
304303
this->UpdatePlugins();
304+
305+
this->dataPtr->receivedInitialState = true;
305306
}
306307

307308
/////////////////////////////////////////////////

0 commit comments

Comments
 (0)