darwin: add another preemptive gui() call when using chg
authorKyle Lippincott <spectral@google.com>
Thu, 20 Feb 2020 15:15:23 -0800
changeset 44368 6392bd7c26a8
parent 44367 9dab3fa64325
child 44369 815c63526d1d
darwin: add another preemptive gui() call when using chg Changeset a89381e04c58 added this gui() call before background forks, and Google's extensions do background forks on essentially every invocation for logging purposes. The crash is reliably (though not 100%) reproducible without this change when running `HGPLAIN=1 chg status` in one of our repos. With this fix, I haven't been able to trigger the crash anymore. Differential Revision: https://phab.mercurial-scm.org/D8141
mercurial/commandserver.py
--- a/mercurial/commandserver.py	Fri Dec 20 13:24:46 2019 -0800
+++ b/mercurial/commandserver.py	Thu Feb 20 15:15:23 2020 -0800
@@ -545,6 +545,10 @@
         if maxlen < 0:
             raise error.Abort(_(b'negative max-repo-cache size not allowed'))
         self._repoloader = repocache.repoloader(ui, maxlen)
+        # attempt to avoid crash in CoreFoundation when using chg after fix in
+        # a89381e04c58
+        if pycompat.isdarwin:
+            procutil.gui()
 
     def init(self):
         self._sock = socket.socket(socket.AF_UNIX)