Hi,

pcbnew is segfaulting on launch on my MacOS Sierra build, due to a null
dereference in the coroutine code:

coroutine.h
408    static CONTEXT_T callerStub( CONTEXT_T caller, INVOCATION_ARGS* aArgsPtr 
)
409    {
410        const auto& args = *aArgsPtr;
411        auto* cor = args.destination;

aArgsPtr is null and I don't understand WHY. However, I was able to make
things appear to work by short-circuiting this function if the argument
is null.

Patch attached. It Works For Me™, but I'd like someone who knows the
coroutine code to look and make sure I haven't made a mess of things.

-- 
Chris
>From 872d6aa16cb027dfc04da18daab85168da40fa71 Mon Sep 17 00:00:00 2001
From: Chris Pavlina <[email protected]>
Date: Wed, 22 Feb 2017 20:09:22 -0500
Subject: [PATCH] Fix MacOS coroutine segfault

---
 include/tool/coroutine.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/tool/coroutine.h b/include/tool/coroutine.h
index 36171a757..231e47a2a 100644
--- a/include/tool/coroutine.h
+++ b/include/tool/coroutine.h
@@ -407,6 +407,9 @@ private:
     /* real entry point of the coroutine */
     static CONTEXT_T callerStub( CONTEXT_T caller, INVOCATION_ARGS* aArgsPtr )
     {
+        if( !aArgsPtr )
+            return std::move( caller );
+
         const auto& args = *aArgsPtr;
         auto* cor = args.destination;
 
-- 
2.11.1

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to