diff --git a/Software/LMSourceCode/ImageProcessing/gs_ipc_system.cpp b/Software/LMSourceCode/ImageProcessing/gs_ipc_system.cpp index 35953f10..4252e616 100644 --- a/Software/LMSourceCode/ImageProcessing/gs_ipc_system.cpp +++ b/Software/LMSourceCode/ImageProcessing/gs_ipc_system.cpp @@ -80,7 +80,7 @@ namespace golf_sim { GolfSimMessageProducer* GolfSimIpcSystem::producer_ = nullptr; std::string GolfSimIpcSystem::kActiveMQLMIdProperty = "LM_System_ID"; - + bool GolfSimIpcSystem::active_mqlibrary_initialized_ = false; cv::Mat GolfSimIpcSystem::last_received_image_; std::mutex GolfSimIpcSystem::last_received_image_mutex_; @@ -102,7 +102,7 @@ namespace golf_sim { } activemq::library::ActiveMQCPP::initializeLibrary(); - + active_mqlibrary_initialized_ = true; // Set the URI to point to the IP Address of your broker. // add any optional params to the url to enable things like @@ -198,17 +198,26 @@ namespace golf_sim { consumer_->Shutdown(); } - producer_->Shutdown(); + if (producer_ != nullptr) { + producer_->Shutdown(); + } // TBD - Give other threads a moment to shut down sleep(4); if (consumer_ != nullptr) { delete consumer_; + consumer_ = nullptr; + } + if (producer_ != nullptr) { + delete producer_; + producer_ = nullptr; } - delete producer_; - activemq::library::ActiveMQCPP::shutdownLibrary(); + if (active_mqlibrary_initialized_ == true) { + activemq::library::ActiveMQCPP::shutdownLibrary(); + active_mqlibrary_initialized_ = false; + } return true; } diff --git a/Software/LMSourceCode/ImageProcessing/gs_ipc_system.h b/Software/LMSourceCode/ImageProcessing/gs_ipc_system.h index 0f5ab605..79fe1238 100644 --- a/Software/LMSourceCode/ImageProcessing/gs_ipc_system.h +++ b/Software/LMSourceCode/ImageProcessing/gs_ipc_system.h @@ -66,6 +66,7 @@ namespace golf_sim { private: static GolfSimMessageConsumer* consumer_; static GolfSimMessageProducer* producer_; + static bool active_mqlibrary_initialized_; }; } diff --git a/Software/web-server/static/js/testing.js b/Software/web-server/static/js/testing.js index 8ad0d2ce..842f65cf 100644 --- a/Software/web-server/static/js/testing.js +++ b/Software/web-server/static/js/testing.js @@ -1,4 +1,4 @@ -/* globals setTheme, closeModal */ +/* globals setTheme */ let runningTools = new Set(); let outputBuffer = []; @@ -248,6 +248,11 @@ function showImageResult(toolId, imageUrl) { modal.style.display = 'block'; } +function closeTestModal() { + modal = document.getElementById('testModal'); + modal.style.display = 'none'; +} + function showError(message) { appendOutput(`[ERROR] ${message}`, 'error'); } diff --git a/Software/web-server/templates/testing.html b/Software/web-server/templates/testing.html index 5e2deaed..741af61b 100644 --- a/Software/web-server/templates/testing.html +++ b/Software/web-server/templates/testing.html @@ -126,7 +126,7 @@

Test Output