Reapply "pmt: use constructor/destructor attributes insetad of class"

This reverts commit d4703df1a5.
This commit is contained in:
2025-08-15 20:02:29 +03:00
parent bfd5a78863
commit 9391847534
2 changed files with 8 additions and 18 deletions

View File

@@ -24,17 +24,19 @@
#include <unistd.h>
namespace PartitionManager {
variableProtect protector;
auto Variables = new VariableTable();
variableProtect::variableProtect() {
__attribute__((constructor))
void init() {
Helper::LoggingProperties::setLogFile("/sdcard/Documents/last_pmt_logs.log");
}
variableProtect::~variableProtect() { delete _ptr; }
void variableProtect::setVariablePointer(basic_variables *&_ptr) {
this->_ptr = _ptr;
__attribute__((destructor))
void cleanup() {
delete Variables;
}
auto Variables = new VariableTable();
basic_variables::~basic_variables() { delete PartMap; }
basic_variables::basic_variables()
: logFile(Helper::LoggingProperties::FILE), onLogical(false),
@@ -50,7 +52,6 @@ int Main(int argc, char **argv) {
try {
// try-catch start
CLI::App AppMain{"Partition Manager Tool"};
protector.setVariablePointer(Variables);
FunctionManager FuncManager;
AppMain.fallthrough(true);