From 6d53e23c76dc9093fea8958d0ae2328f9f5bcedd Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Fri, 4 Jun 2021 19:22:12 -0400
Subject: Fix initialisation order

---
 src/Drivers.hpp  |  2 +-
 src/Patchage.cpp |  6 +++---
 src/Patchage.hpp | 25 ++++++++++++-------------
 3 files changed, 16 insertions(+), 17 deletions(-)

(limited to 'src')

diff --git a/src/Drivers.hpp b/src/Drivers.hpp
index 0e3cdce..582f953 100644
--- a/src/Drivers.hpp
+++ b/src/Drivers.hpp
@@ -55,9 +55,9 @@ public:
 
 protected:
   ILog&                        _log;
+  Driver::EventSink            _emit_event;
   std::unique_ptr<Driver>      _alsa_driver;
   std::unique_ptr<AudioDriver> _jack_driver;
-  Driver::EventSink            _emit_event;
 };
 
 } // namespace patchage
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 5adb524..2636066 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -167,7 +167,6 @@ port_order(const GanvPort* a, const GanvPort* b, void*)
 
 Patchage::Patchage(Options options)
   : _xml(UIFile::open("patchage"))
-  , _conf([this](const Setting& setting) { on_conf_change(setting); })
   , INIT_WIDGET(_about_win)
   , INIT_WIDGET(_main_scrolledwin)
   , INIT_WIDGET(_main_win)
@@ -203,10 +202,11 @@ Patchage::Patchage(Options options)
   , INIT_WIDGET(_main_paned)
   , INIT_WIDGET(_log_scrolledwindow)
   , INIT_WIDGET(_status_text)
-  , _legend(nullptr)
+  , _conf([this](const Setting& setting) { on_conf_change(setting); })
   , _log(_status_text)
-  , _drivers(_log, [this](const Event& event) { on_driver_event(event); })
   , _canvas(new Canvas{_log, _action_sink, 1600 * 2, 1200 * 2})
+  , _legend(nullptr)
+  , _drivers(_log, [this](const Event& event) { on_driver_event(event); })
   , _reactor(_conf, _drivers, *_canvas, _log)
   , _action_sink([this](const Action& action) { _reactor(action); })
   , _options{options}
diff --git a/src/Patchage.hpp b/src/Patchage.hpp
index 6654151..504eaac 100644
--- a/src/Patchage.hpp
+++ b/src/Patchage.hpp
@@ -156,13 +156,6 @@ protected:
 
   Glib::RefPtr<Gtk::Builder> _xml;
 
-  std::unique_ptr<Canvas> _canvas;
-  std::mutex              _events_mutex;
-  std::queue<Event>       _driver_events;
-  Configuration           _conf;
-
-  BufferSizeColumns _buf_size_columns;
-
   Widget<Gtk::AboutDialog>    _about_win;
   Widget<Gtk::ScrolledWindow> _main_scrolledwin;
   Widget<Gtk::Window>         _main_win;
@@ -198,12 +191,18 @@ protected:
   Widget<Gtk::Paned>          _main_paned;
   Widget<Gtk::ScrolledWindow> _log_scrolledwindow;
   Widget<Gtk::TextView>       _status_text;
-  Legend*                     _legend;
-  TextViewLog                 _log;
-  Metadata                    _metadata;
-  Drivers                     _drivers;
-  Reactor                     _reactor;
-  ActionSink                  _action_sink;
+
+  Configuration           _conf;
+  TextViewLog             _log;
+  std::unique_ptr<Canvas> _canvas;
+  std::mutex              _events_mutex;
+  std::queue<Event>       _driver_events;
+  BufferSizeColumns       _buf_size_columns;
+  Legend*                 _legend;
+  Metadata                _metadata;
+  Drivers                 _drivers;
+  Reactor                 _reactor;
+  ActionSink              _action_sink;
 
   Glib::RefPtr<Gtk::TextTag> _error_tag;
   Glib::RefPtr<Gtk::TextTag> _warning_tag;
-- 
cgit v1.2.1