From 6ba0e3d1b4c9e9ea2b1dbbba43cb4032ff8d665f Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 18 Jul 2019 14:29:22 +0200 Subject: [PATCH] Be more conservative in clearing the cache of MappingQCache --- source/fe/mapping_q_cache.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/fe/mapping_q_cache.cc b/source/fe/mapping_q_cache.cc index 32d5bb7491..9c7cae10e6 100644 --- a/source/fe/mapping_q_cache.cc +++ b/source/fe/mapping_q_cache.cc @@ -42,8 +42,12 @@ MappingQCache::MappingQCache( template MappingQCache::~MappingQCache() { - if (clear_signal.connected()) - clear_signal.disconnect(); + // When this object goes out of scope, we want the cache to get cleared and + // free its memory before the signal is disconnected in order to not work on + // invalid memory that has been left back by freeing an object of this + // class. + support_point_cache.reset(); + clear_signal.disconnect(); } -- 2.39.5