[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
+7
-26
@@ -22,7 +22,6 @@
|
||||
#define _HELPERS_H_
|
||||
|
||||
#include "eeprominterface.h"
|
||||
#include "modeledit/modeledit.h"
|
||||
#include <QCheckBox>
|
||||
#include <QSpinBox>
|
||||
#include <QTableWidget>
|
||||
@@ -69,7 +68,10 @@ class GVarGroup: public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true, ModelPanel * panel=NULL);
|
||||
GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true);
|
||||
|
||||
signals:
|
||||
void valueChanged();
|
||||
|
||||
protected slots:
|
||||
void gvarCBChanged(int);
|
||||
@@ -84,7 +86,6 @@ class GVarGroup: public QObject {
|
||||
int & weight;
|
||||
double step;
|
||||
bool lock;
|
||||
ModelPanel * panel;
|
||||
};
|
||||
|
||||
#define HIDE_DIFF 0x01
|
||||
@@ -157,26 +158,6 @@ QString getFrSkySrc(int index);
|
||||
|
||||
void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx);
|
||||
|
||||
template <class T>
|
||||
QVector<T> findWidgets(QObject * object, const QString & name)
|
||||
{
|
||||
QVector<T> result;
|
||||
QRegExp rx(name.arg("([0-9]+)"));
|
||||
QList<T> children = object->findChildren<T>();
|
||||
foreach(T child, children) {
|
||||
int pos = rx.indexIn(child->objectName());
|
||||
if (pos >= 0) {
|
||||
QStringList list = rx.capturedTexts();
|
||||
int index = list[1].toInt();
|
||||
if (result.size() <= index) {
|
||||
result.resize(index+1);
|
||||
}
|
||||
result[index] = child;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Format a pixmap to fit on the current firmware
|
||||
QPixmap makePixMap(const QImage & image);
|
||||
|
||||
@@ -249,13 +230,13 @@ public:
|
||||
|
||||
void resizeColumnsToContents();
|
||||
void setColumnWidth(int col, int width);
|
||||
void pushRowsUp(int row);
|
||||
void pushRowsUp(int row);
|
||||
|
||||
private:
|
||||
#if defined(TABLE_LAYOUT)
|
||||
QTableWidget * tableWidget;
|
||||
QTableWidget * tableWidget;
|
||||
#else
|
||||
QGridLayout * gridWidget;
|
||||
QGridLayout * gridWidget;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user