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

This reverts commit 7240cca537.
This commit is contained in:
2025-08-15 17:29:28 +03:00
parent c3a5e97d41
commit d4703df1a5
3 changed files with 19 additions and 9 deletions

View File

@@ -25,7 +25,7 @@ PMT is designed for developers, technicians, and Android enthusiasts who need fi
## Documentation
For all information about PMT, see the [wiki](https://github.com/ShawkTeam/pmt-renovated/wiki).\
For all information about PMT, see the [wiki](https://github.com/ShawkTeam/pmt-renovated/wiki)\
Read [Wiki - Using PMT via Termux or ADB](https://github.com/ShawkTeam/pmt-renovated/wiki/Using-PMT-via-Termux-or-ADB) for learn how to use PMT via Termux or ADB.\
Detailed usage instructions and option references can be found in the [Wiki - Usage](https://github.com/ShawkTeam/pmt-renovated/wiki/Usage).

View File

@@ -70,6 +70,17 @@ public:
bool forceProcess;
};
class variableProtect final {
private:
basic_variables *_ptr = nullptr;
public:
variableProtect();
~variableProtect();
void setVariablePointer(basic_variables *&_ptr);
};
using FunctionBase = basic_function;
using FunctionManager = basic_function_manager;
using VariableTable = basic_variables;

View File

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