[simulation] Fix some potential crashes & 26 memory leaks, improve LCD redraws. (#4634)
* [simulation] Hardening: Fix some potential crashes & 26 memory leaks, improve LCD performance. * [simpgmspace] Init trims; Make sure `REa` is really defined (to match board files). * [simpgmspace][opentxsimulator] Verify current running state before start/stop; Move rotary enc. init. * [simpgmspace][LcdWidget] Improve performance by moving LCD content change check to lcdRefresh() & limiting LcdWidget refresh time to 60 fps max. * [simueeprom] Ensure thread could be started, set default running state to false. * [simufatfs] Fix paths report trace. * [eepromimportexport] Fix memory leaks resulting from import debugging scheme being used. * [customdebug] Introduce new scheme for custom debug output in compliance with Qt recommendations (see docs for QLoggingCategory). * [opentxeeprom] Fix extra conversion table cache elements being created and also not properly deleted (and hence leaking). * [opentxinterface] Unregister EEpromInterfaces in unregisterOpenTxFirmwares(); * [storage] Unregister storage factories on exit (fixes leak); create virtual StorageFormat/StorageFactory destructors (prevents warnings). * [helpers] GVarGroup now emits own signal, no need to pass ModelPanel pointer (removes dependency on modeledit.h) * [DebugOutput] Clear simulator trace hook before exiting (prevent possible issues); Fix leak and possible bad QString allocations when reading from buffer; Fix leak with combo box event filter. * [TelemetrySimulator] Fix leak by deleting LogPlaybackController object on exit; Only set up data fields once; convert timers to static. * [build] Consolidate all Companion/Simulator shared items in `common` library to reduce build time/etc (node & edge still remain awkward). * [simulatorwidget] Delete removed spacer object (previously-forgotten "26th" leak). * [DebugOutput] Fix stray trailing characters issue with new text buffer allocation (from previous commit); Increase maximum buffer sizes to better accommodate slower systems. * Cosmetics.
This commit is contained in:
committed by
Bertrand Songis
parent
52e65179a8
commit
4aa0c1bbe4
@@ -48,14 +48,14 @@ class StorageFormat
|
||||
board(Board::BOARD_UNKNOWN)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~StorageFormat() {}
|
||||
virtual bool load(RadioData & radioData) = 0;
|
||||
virtual bool write(const RadioData & radioData) = 0;
|
||||
|
||||
QString error() {
|
||||
return _error;
|
||||
}
|
||||
|
||||
|
||||
QString warning() {
|
||||
return _warning;
|
||||
}
|
||||
@@ -84,13 +84,13 @@ class StorageFormat
|
||||
qDebug() << qPrintable(QString("[%1] error: %2").arg(name()).arg(error));
|
||||
_error = error;
|
||||
}
|
||||
|
||||
|
||||
void setWarning(const QString & warning)
|
||||
{
|
||||
qDebug() << qPrintable(QString("[%1] warning: %2").arg(name()).arg(warning));
|
||||
_warning = warning;
|
||||
}
|
||||
|
||||
|
||||
QString filename;
|
||||
uint8_t version;
|
||||
QString _error;
|
||||
@@ -104,6 +104,7 @@ class StorageFactory
|
||||
StorageFactory()
|
||||
{
|
||||
}
|
||||
virtual ~StorageFactory() {}
|
||||
virtual QString name() = 0;
|
||||
virtual bool probe(const QString & filename) = 0;
|
||||
virtual StorageFormat * instance(const QString & filename) = 0;
|
||||
@@ -118,22 +119,22 @@ class DefaultStorageFactory : public StorageFactory
|
||||
_name(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual QString name()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
virtual bool probe(const QString & filename)
|
||||
{
|
||||
return filename.toLower().endsWith("." + _name);
|
||||
}
|
||||
|
||||
|
||||
virtual StorageFormat * instance(const QString & filename)
|
||||
{
|
||||
return new T(filename);
|
||||
}
|
||||
|
||||
|
||||
QString _name;
|
||||
};
|
||||
|
||||
@@ -144,24 +145,25 @@ class Storage : public StorageFormat
|
||||
StorageFormat(filename)
|
||||
{
|
||||
}
|
||||
|
||||
virtual QString name() { return "storage"; };
|
||||
|
||||
|
||||
virtual QString name() { return "storage"; }
|
||||
|
||||
void setError(const QString & error)
|
||||
{
|
||||
_error = error;
|
||||
}
|
||||
|
||||
|
||||
void setWarning(const QString & warning)
|
||||
{
|
||||
_warning = warning;
|
||||
}
|
||||
|
||||
|
||||
virtual bool load(RadioData & radioData);
|
||||
virtual bool write(const RadioData & radioData);
|
||||
};
|
||||
|
||||
void registerStorageFactories();
|
||||
void unregisterStorageFactories();
|
||||
|
||||
#if 0
|
||||
unsigned long LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
Reference in New Issue
Block a user