From 620ab66e75cb1b43e9a49cabf51de5b6c4c01c41 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 18 Jan 2020 18:07:55 -0700 Subject: [PATCH] remove fragile union design Absurd to be memory-conscious about a couple of member variables in an object that represents user input --- libs/ardour/ardour/transport_fsm.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/libs/ardour/ardour/transport_fsm.h b/libs/ardour/ardour/transport_fsm.h index 86133e77c5..7f6728da07 100644 --- a/libs/ardour/ardour/transport_fsm.h +++ b/libs/ardour/ardour/transport_fsm.h @@ -44,21 +44,20 @@ struct TransportFSM struct Event : public boost::intrusive::list_base_hook<> { EventType type; - union { - bool abort; /* for stop */ - LocateTransportDisposition ltd; /* for locate */ - }; - union { - bool clear_state; /* for stop */ - bool with_flush; /* for locate */ - }; + /* for stop */ + bool abort; + bool clear_state; /* for locate */ + LocateTransportDisposition ltd; + bool with_flush; samplepos_t target; bool for_loop_end; bool force; Event (EventType t) : type (t) + , abort (false) + , clear_state (false) , ltd (MustStop) , with_flush (false) , target (0) @@ -72,11 +71,18 @@ struct TransportFSM : type (t) , abort (ab) , clear_state (cl) + , ltd (MustStop) + , with_flush (false) + , target (0) + , for_loop_end (false) + , force (false) { assert (t == StopTransport); } Event (EventType t, samplepos_t pos, LocateTransportDisposition l, bool fl, bool lp, bool f4c) : type (t) + , abort (false) + , clear_state (false) , ltd (l) , with_flush (fl) , target (pos)