Merge pull request #1127 from libgit2/fix-mwindow-threading Fix mwindow mutex initialization and error checking