]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Be more conservative in clearing the cache of MappingQCache 8390/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 18 Jul 2019 12:29:22 +0000 (14:29 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 18 Jul 2019 15:04:46 +0000 (17:04 +0200)
source/fe/mapping_q_cache.cc

index 32d5bb749199e412fc62b7facccbb23960151cdf..9c7cae10e6e75de61d9dd18f9fe41b1494b576ef 100644 (file)
@@ -42,8 +42,12 @@ MappingQCache<dim, spacedim>::MappingQCache(
 template <int dim, int spacedim>
 MappingQCache<dim, spacedim>::~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();
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.