Mrntt: Call shutdownSalmanoff after exiting main loop

We moved initializeSalmanoff and shutdownSalmanoff into
salmanoff.cpp. Now we also invoke shutdownSalmanoff when exiting
to destroy subsystems and components gracefully.

This fixes the segfault that was thrown on every program exit
when xcbWindow had captured a window.
This commit is contained in:
2025-07-30 10:07:52 -04:00
parent e276fcbdce
commit 4fde28dad8
4 changed files with 23 additions and 3 deletions
-2
View File
@@ -28,8 +28,6 @@ struct CrtCommandLineArgs
static void set(int argc, char *argv[], char *envp[]);
};
void initializeSalmanoff(void);
} // namespace smo
#endif // _MARIONETTE_H
+11
View File
@@ -0,0 +1,11 @@
#ifndef _SALMANOFF_H
#define _SALMANOFF_H
namespace smo {
void initializeSalmanoff(void);
void shutdownSalmanoff(void);
} // namespace smo
#endif // _SALMANOFF_H
+2 -1
View File
@@ -6,6 +6,7 @@
#include <mind.h>
#include <componentThread.h>
#include <marionette/marionette.h>
#include <salmanoff.h>
namespace smo {
@@ -104,6 +105,7 @@ void ComponentThread::marionetteMain(ComponentThread& self)
}
std::cout << __func__ << ": Exited event loop" << "\n";
shutdownSalmanoff();
}
catch (const std::exception& e)
{
@@ -122,5 +124,4 @@ void ComponentThread::marionetteMain(ComponentThread& self)
std::cout << __func__ << ": Exiting normally" << std::endl;
}
} // namespace smo
+10
View File
@@ -23,4 +23,14 @@ std::cerr << "Done attachAllSenseDevicesFromSpecs" << std::endl;
std::cout << __func__ << ": Done." << std::endl;
}
void shutdownSalmanoff(void)
{
std::cout << __func__ << ": Entered." << std::endl;
sense_api::SenseApiManager::getInstance().detachAllSenseDevices();
sense_api::SenseApiManager::getInstance().finalizeAllSenseApiLibs();
std::cout << __func__ << ": Done." << std::endl;
}
} // namespace smo