From 1268b4b4632a6b897568ef98cc74fbf1beb796d5 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Wed, 6 Feb 2019 20:06:27 +0100
Subject: [PATCH] leave memory cleanup to the OS at exit This manual cleanup
 led to a segmentation fault on my system, as the static scene instance was
 already deleted when this function was called. At least on my machine I get a
 clean exit now...

---
 modules/gfx/pymod/export_scene.cc | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/modules/gfx/pymod/export_scene.cc b/modules/gfx/pymod/export_scene.cc
index 0c4ff6b87..11d0f49d5 100644
--- a/modules/gfx/pymod/export_scene.cc
+++ b/modules/gfx/pymod/export_scene.cc
@@ -87,10 +87,6 @@ void scene_set_hemi_p(Scene* s, tuple p)
 
 } // anon ns
 
-void clear_scene() {
-  Scene::Instance().RemoveAll();
-}
-
 void export_Scene()
 {
   def("Scene",get_scene,return_value_policy<reference_existing_object>());
@@ -268,15 +264,5 @@ void export_Scene()
     .add_property("hemi_params",scene_get_hemi_p,scene_set_hemi_p)
   ;
 
-  // we need to make sure there are no pending references to Python objects
-  // tied to the scene singleton. The destructor of 
-  // scene may be called after Python is shutdown which results
-  // in a segfault.
-  scope().attr("__dict__")["atexit"]=handle<>(PyImport_ImportModule("atexit"));
-
-  def("_clear_scene", &clear_scene);
-  object r=scope().attr("_clear_scene");
-  scope().attr("atexit").attr("register")(r);
-
 }
 
-- 
GitLab