cleanup and debug logs

This commit is contained in:
matlabbe
2026-07-03 12:10:57 -07:00
parent 0b18ede2fb
commit d868cffc76
2 changed files with 7 additions and 10 deletions
+7
View File
@@ -107,10 +107,14 @@ void CameraRealSense2::close()
{ {
if(!_sensor.get_active_streams().empty()) if(!_sensor.get_active_streams().empty())
{ {
std::string sensorName = _sensor.supports(RS2_CAMERA_INFO_NAME) ? _sensor.get_info(RS2_CAMERA_INFO_NAME) : "?";
try try
{ {
UDEBUG("stop() sensor \"%s\"...", sensorName.c_str());
_sensor.stop(); _sensor.stop();
UDEBUG("stop() sensor \"%s\" done; close()...", sensorName.c_str());
_sensor.close(); _sensor.close();
UDEBUG("close() sensor \"%s\" done", sensorName.c_str());
} }
catch(const rs2::error & error) catch(const rs2::error & error)
{ {
@@ -119,12 +123,15 @@ void CameraRealSense2::close()
} }
} }
#ifdef WIN32 #ifdef WIN32
UDEBUG("Windows-only: Hardware reset (to avoid freezing when clearing devices)...");
dev_[i].hardware_reset(); // To avoid freezing on some Windows computers in the following destructor dev_[i].hardware_reset(); // To avoid freezing on some Windows computers in the following destructor
// Don't do this on linux (tested on Ubuntu 18.04, realsense v2.41.0): T265 cannot be restarted // Don't do this on linux (tested on Ubuntu 18.04, realsense v2.41.0): T265 cannot be restarted
UDEBUG("Windows-only: Hardware reset... done");
#endif #endif
} }
UDEBUG("Clearing devices..."); UDEBUG("Clearing devices...");
dev_.clear(); dev_.clear();
UDEBUG("Clearing devices... done!");
} }
catch(const rs2::error & error) catch(const rs2::error & error)
{ {
-10
View File
@@ -265,16 +265,6 @@ CloudViewer::~CloudViewer()
{ {
UDEBUG(""); UDEBUG("");
this->clear(); this->clear();
#if VTK_MAJOR_VERSION > 8
// Explicitly release the OpenGL context/resources bound to this widget's native window
// before the render window is torn down.
if(this->renderWindow())
{
this->makeCurrent();
this->renderWindow()->Finalize();
this->doneCurrent();
}
#endif
delete _visualizer; delete _visualizer;
UDEBUG(""); UDEBUG("");
} }