From dbdd42585e8aa3333010bd57f0cd1129ac3c1d2f Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Thu, 7 Feb 2019 21:46:35 +0100
Subject: Included the leak tracker into the Python interpreter.

---
 plugins/pychrysalide/pychrysa.c |  6 ++++++
 src/Makefile.am                 | 16 ++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c
index 723c2bc..4cb18d9 100644
--- a/plugins/pychrysalide/pychrysa.c
+++ b/plugins/pychrysalide/pychrysa.c
@@ -34,6 +34,7 @@
 
 
 #include <config.h>
+#include <gleak.h>
 #include <common/cpp.h>
 #include <common/environment.h>
 #include <common/extstr.h>
@@ -309,6 +310,11 @@ static void PyExit_pychrysalide(void)
 
     set_current_project(NULL);
 
+#ifdef TRACK_GOBJECT_LEAKS
+    if (_standalone)
+        dump_remaining_gtypes();
+#endif
+
 }
 
 
diff --git a/src/Makefile.am b/src/Makefile.am
index ffa4bb5..11157a4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,7 +13,14 @@ bin_PROGRAMS = chrysalide csrvmng
 
 #--- libchrysacore
 
-libchrysacore_la_SOURCES =
+if TRACK_GOBJECT_LEAKS
+
+GOBJECT_LEAKS_SOURCES = gleak.h gleak.c
+
+endif
+
+libchrysacore_la_SOURCES = 				\
+	$(GOBJECT_LEAKS_SOURCES)
 
 libchrysacore_la_LDFLAGS = $(LIBGTK_LIBS) $(LIBXML_LIBS) $(LIBSQLITE_LIBS) $(LIBARCHIVE_LIBS)
 
@@ -35,14 +42,7 @@ libchrysacore_la_LIBADD =				\
 # Programme principal
 ############################################################
 
-if TRACK_GOBJECT_LEAKS
-
-GOBJECT_LEAKS_SOURCES = gleak.h gleak.c
-
-endif
-
 chrysalide_SOURCES = 					\
-	$(GOBJECT_LEAKS_SOURCES)			\
 	main.c
 
 
-- 
cgit v0.11.2-87-g4458