Crash after saving to a git repo

Linus Torvalds torvalds at linux-foundation.org
Mon Mar 31 13:37:41 PDT 2014


On Mon, Mar 31, 2014 at 1:21 PM, Anton Lundin <glance at acc.umu.se> wrote:
>
> I managed to figure out that the Ubuntu version is built with
> -DTHREADSAFE=ON, but the packages both in f19 and f20 is built without
> threadsafe.

Ahh.

I think we need to call git_threads_init() somewhere. The docs say:

  "If libgit2 has been built with GIT_THREADS on, this function must
be called once before any other library functions.

  If libgit2 has been built without GIT_THREADS support, this function
is a no-op"

so try something like the attached. Maybe it fixes the problem with
your Ubuntu package too?

               Linus
-------------- next part --------------
 main.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/main.cpp b/main.cpp
index a011b4cafbc4..fd48223244df 100644
--- a/main.cpp
+++ b/main.cpp
@@ -11,6 +11,7 @@
 #include "qt-ui/diveplanner.h"
 
 #include <QStringList>
+#include <git2.h>
 
 QTranslator *qtTranslator, *ssrfTranslator;
 
@@ -41,6 +42,7 @@ int main(int argc, char **argv)
 			files.push_back(a);
 		}
 	}
+	git_threads_init();
 	setup_system_prefs();
 	prefs = default_prefs;
 	fill_profile_color();


More information about the subsurface mailing list