[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:
Max Paperno
2017-03-21 07:43:40 +01:00
committed by Bertrand Songis
parent 52e65179a8
commit 4aa0c1bbe4
28 changed files with 290 additions and 210 deletions
+11 -18
View File
@@ -124,7 +124,9 @@ add_subdirectory(thirdparty/qxtcommandoptions)
set(common_SRCS
appdebugmessagehandler.cpp
boards.cpp
customdebug.cpp
eeprominterface.cpp
helpers.cpp
radiodata.cpp
firmwares/er9x/er9xeeprom.cpp
firmwares/er9x/er9xinterface.cpp
@@ -132,21 +134,25 @@ set(common_SRCS
firmwares/ersky9x/ersky9xinterface.cpp
firmwares/opentx/opentxeeprom.cpp
firmwares/opentx/opentxinterface.cpp
modeledit/node.cpp # used in simulator
modeledit/edge.cpp # used by node
)
set(common_MOC_HDRS
appdebugmessagehandler.h
helpers.h
modeledit/node.h
)
qt5_wrap_cpp(common_SRCS ${common_MOC_HDRS})
add_library(common ${common_SRCS})
qt5_use_modules(common Core Xml Widgets)
target_link_libraries(common simulation)
############# Companion ###############
set(companion_SRCS
helpers.cpp
helpers_html.cpp
mdichild.cpp
modelslist.cpp
@@ -206,7 +212,6 @@ set(companion_MOC_HDRS
mdichild.h
mainwindow.h
radionotfound.h
helpers.h
wizarddialog.h
modelprinter.h
multimodelprinter.h
@@ -259,9 +264,9 @@ qt5_wrap_ui(companion_SRCS ${companion_UIS})
qt5_wrap_cpp(companion_SRCS ${companion_MOC_HDRS})
qt5_add_translation(companion_QM ${companion_TS})
qt5_add_resources(companion_RCC ${companion_RESOURCES})
add_custom_target(gen_qrc DEPENDS ${companion_RCC})
add_custom_target(gen_qrc DEPENDS ${companion_RCC} ${companion_QM})
add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${companion_SRCS} ${companion_RCC} ${companion_QM})
add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${companion_SRCS} ${companion_RCC})
add_dependencies(${COMPANION_NAME} gen_qrc)
qt5_use_modules(${COMPANION_NAME} Core Widgets Network)
@@ -272,19 +277,7 @@ PrintTargetReport("${COMPANION_NAME}")
############# Standalone simulator ###############
set(simu_SRCS
modeledit/node.cpp
modeledit/edge.cpp
helpers.cpp
simulator.cpp
)
set(simu_MOC_HDRS
modeledit/node.h
helpers.h
)
qt5_wrap_cpp(simu_SRCS ${simu_MOC_HDRS} )
set(simu_SRCS simulator.cpp )
if(WIN32)
list(APPEND simu_SRCS icon.rc)
@@ -293,7 +286,7 @@ endif()
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${WIN_EXECUTABLE_TYPE} ${simu_SRCS} ${companion_RCC})
add_dependencies(${SIMULATOR_NAME} gen_qrc)
target_link_libraries(${SIMULATOR_NAME} PRIVATE simulation common shared storage qxtcommandoptions ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${WIN_LINK_LIBRARIES})
target_link_libraries(${SIMULATOR_NAME} PRIVATE simulation common storage qxtcommandoptions ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${WIN_LINK_LIBRARIES})
############# Translations ####################