From 646d72d4a2dd413117b052250be028a54957237d Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Wed, 18 Apr 2018 16:01:07 +0200
Subject: [PATCH] BUG: clean registry sooner to avoid dl_close() crash

---
 Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx
index 4349a77e2d..ba56afbd28 100644
--- a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx
+++ b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx
@@ -338,6 +338,10 @@ int main(int argc, char* argv[])
   indexFile << group << "|" << module << std::endl;
   indexFile.close();
   std::cerr << "Updated " << algs_txt << std::endl;
+
+  appli = nullptr;
+  ApplicationRegistry::CleanRegistry();
+
   return EXIT_SUCCESS;
   }
 
-- 
GitLab