From 2f1b9b0e15f31c06789befb126d9ba8f6c93de46 Mon Sep 17 00:00:00 2001 From: raulmur Date: Wed, 4 Jan 2017 11:05:17 +0100 Subject: [PATCH] Fixed shutdown without viewer --- src/System.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/System.cc b/src/System.cc index 48586e406d..8df4157095 100644 --- a/src/System.cc +++ b/src/System.cc @@ -303,16 +303,20 @@ void System::Shutdown() mpLocalMapper->RequestFinish(); mpLoopCloser->RequestFinish(); if(mpViewer) + { mpViewer->RequestFinish(); + while(!mpViewer->isFinished()) + usleep(5000); + } // Wait until all thread have effectively stopped - while(!mpLocalMapper->isFinished() || !mpLoopCloser->isFinished() || - !mpViewer->isFinished() || mpLoopCloser->isRunningGBA()) + while(!mpLocalMapper->isFinished() || !mpLoopCloser->isFinished() || mpLoopCloser->isRunningGBA()) { usleep(5000); } - pangolin::BindToContext("ORB-SLAM2: Map Viewer"); + if(mpViewer) + pangolin::BindToContext("ORB-SLAM2: Map Viewer"); } void System::SaveTrajectoryTUM(const string &filename)