Compare commits

...

2 Commits

Author SHA1 Message Date
Dirk Hohndel
2fd0cd4ea1 selection: prevent use after free crash
This is hiding a bigger issue in the way changes are propagated through
the code, but it should stop an annoying crash in 5.0 from happening.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-30 14:03:52 -07:00
Dirk Hohndel
a6ba598e9a build-system: make ASAN builds easier
This is a bit lacking sophistication (you need to remember to make clean
before rebuilding when changing this option, etc), but it works well
enough for my purpuses.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-03-30 12:07:56 -07:00
2 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,9 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
"We don't support building in source, please create a build folder elsewhere and remember to run git clean -xdf to remove temporary files created by CMake."
)
#Option for memory debugging
option(SUBSURFACE_ASAN_BUILD "enable memory debugging of Subsurface binary" OFF)
#Option for profiling
option(SUBSURFACE_PROFILING_BUILD "enable profiling of Subsurface binary" OFF)
@ -110,6 +113,11 @@ if (SUBSURFACE_PROFILING_BUILD)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
endif()
# set up ASan
if (SUBSURFACE_ASAN_BUILD)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
# every compiler understands -Wall
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")

View File

@ -377,6 +377,9 @@ void StatsView::replotIfVisible()
void StatsView::divesSelected(const QVector<dive *> &dives)
{
if (dive_table.nr <= 0)
// there are no dives, don't bother (this can happen during reset, for example)
return;
if (isVisible()) {
for (auto &series: series)
series->divesSelected(dives);