Skip to content

Commit

Permalink
Initialize SSLWorld completely before activation
Browse files Browse the repository at this point in the history
  • Loading branch information
g3force committed Apr 17, 2021
1 parent 9c7f10d commit 1124f3d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,19 @@ void MainWindow::changeBallDamping()

void MainWindow::restartSimulator()
{
delete glwidget->ssl;
glwidget->ssl = new SSLWorld(glwidget,glwidget->cfg,glwidget->forms[FORMATION_INSIDE_1],glwidget->forms[FORMATION_INSIDE_1]);
glwidget->ssl->glinit();
glwidget->ssl->visionServer = visionServer;
glwidget->ssl->commandSocket = commandSocket;
glwidget->ssl->blueStatusSocket = blueStatusSocket;
glwidget->ssl->yellowStatusSocket = yellowStatusSocket;
glwidget->ssl->simControlSocket = simControlSocket;
glwidget->ssl->blueControlSocket = blueControlSocket;
glwidget->ssl->yellowControlSocket = yellowControlSocket;
auto newWorld = new SSLWorld(glwidget,glwidget->cfg,glwidget->forms[FORMATION_INSIDE_1],glwidget->forms[FORMATION_INSIDE_1]);
newWorld->glinit();
newWorld->visionServer = visionServer;
newWorld->commandSocket = commandSocket;
newWorld->blueStatusSocket = blueStatusSocket;
newWorld->yellowStatusSocket = yellowStatusSocket;
newWorld->simControlSocket = simControlSocket;
newWorld->blueControlSocket = blueControlSocket;
newWorld->yellowControlSocket = yellowControlSocket;

auto oldWorld = glwidget->ssl;
glwidget->ssl = newWorld;
delete oldWorld;
}

void MainWindow::ballMenuTriggered(QAction* act)
Expand Down

0 comments on commit 1124f3d

Please sign in to comment.