mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-20 14:55:09 +03:00
Simulators and firmwares unregistered when application ends (fixes memory leaks)
This commit is contained in:
parent
ee4ea18a3e
commit
2a54bee20b
8 changed files with 20 additions and 9 deletions
|
@ -156,7 +156,8 @@ int main(int argc, char *argv[])
|
|||
delete splash;
|
||||
delete mainWin;
|
||||
|
||||
unregisterFirmwares();
|
||||
unregisterSimulators();
|
||||
unregisterOpenTxFirmwares();
|
||||
unregisterEEpromInterfaces();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
|
|
|
@ -1642,13 +1642,6 @@ QList<Firmware *> firmwares;
|
|||
Firmware * default_firmware_variant;
|
||||
Firmware * current_firmware_variant;
|
||||
|
||||
void unregisterFirmwares()
|
||||
{
|
||||
foreach (Firmware * f, firmwares) {
|
||||
delete f;
|
||||
}
|
||||
}
|
||||
|
||||
void ShowEepromErrors(QWidget *parent, const QString &title, const QString &mainMessage, unsigned long errorsFound)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)errorsFound);
|
||||
|
|
|
@ -1489,7 +1489,7 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
|
|||
void registerEEpromInterfaces();
|
||||
void unregisterEEpromInterfaces();
|
||||
void registerOpenTxFirmwares();
|
||||
void unregisterFirmwares();
|
||||
void unregisterOpenTxFirmwares();
|
||||
|
||||
enum EepromLoadErrors {
|
||||
NO_ERROR,
|
||||
|
|
|
@ -1436,3 +1436,9 @@ void registerOpenTxFirmwares()
|
|||
current_firmware_variant = default_firmware_variant;
|
||||
}
|
||||
|
||||
void unregisterOpenTxFirmwares()
|
||||
{
|
||||
foreach (Firmware * f, firmwares) {
|
||||
delete f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,5 +130,6 @@ class OpenTxFirmware: public Firmware {
|
|||
};
|
||||
|
||||
void registerOpenTxFirmwares();
|
||||
void unregisterOpenTxFirmwares();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -81,3 +81,9 @@ SimulatorFactory *getSimulatorFactory(const QString &name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void unregisterSimulators()
|
||||
{
|
||||
foreach(SimulatorFactory *factory, registered_simulators) {
|
||||
delete factory;
|
||||
}
|
||||
}
|
|
@ -118,6 +118,7 @@ class SimulatorFactory {
|
|||
};
|
||||
|
||||
void registerSimulators();
|
||||
void unregisterSimulators();
|
||||
SimulatorFactory *getSimulatorFactory(const QString &name);
|
||||
extern QMap<QString, SimulatorFactory *> registered_simulators;
|
||||
|
||||
|
|
|
@ -176,6 +176,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
delete dialog;
|
||||
|
||||
unregisterSimulators();
|
||||
unregisterOpenTxFirmwares();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
SDL_Quit();
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue