summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaces/mackie')
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc11
-rw-r--r--libs/surfaces/mackie/surface.cc6
-rw-r--r--libs/surfaces/mackie/surface.h4
3 files changed, 9 insertions, 12 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 134596d727..6027c8b504 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -713,7 +713,7 @@ MackieControlProtocol::set_device (const string& device_name)
switch_banks (0, true);
- // DeviceChanged ();
+ DeviceChanged ();
return 0;
}
@@ -819,8 +819,13 @@ MackieControlProtocol::create_surfaces ()
if ((fd = input_port.selectable ()) >= 0) {
- surface->input_channel = g_io_channel_unix_new (fd);
- surface->input_source = g_io_create_watch (surface->input_channel, GIOCondition (G_IO_IN|G_IO_HUP|G_IO_ERR));
+ GIOChannel* ioc = g_io_channel_unix_new (fd);
+ surface->input_source = g_io_create_watch (ioc, GIOCondition (G_IO_IN|G_IO_HUP|G_IO_ERR));
+
+ /* make surface's input source now hold the
+ * only reference on the IO channel
+ */
+ g_io_channel_unref (ioc);
/* hack up an object so that in the callback from the event loop
we have both the MackieControlProtocol and the input port.
diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc
index 800fb701a7..020b389ad4 100644
--- a/libs/surfaces/mackie/surface.cc
+++ b/libs/surfaces/mackie/surface.cc
@@ -92,7 +92,6 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui
, _master_fader (0)
, _last_master_gain_written (-0.0f)
, connection_state (0)
- , input_channel (0)
, input_source (0)
{
DEBUG_TRACE (DEBUG::MackieControl, "Surface::Surface init\n");
@@ -169,11 +168,6 @@ Surface::~Surface ()
input_source = 0;
}
- if (input_channel) {
- g_io_channel_unref (input_channel);
- input_channel = 0;
- }
-
delete _jog_wheel;
delete _port;
diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h
index 79edffc030..68b3c5f799 100644
--- a/libs/surfaces/mackie/surface.h
+++ b/libs/surfaces/mackie/surface.h
@@ -204,9 +204,7 @@ public:
MidiByteArray display_line (std::string const& msg, int line_num);
public:
- /* IP MIDI devices need to keep a handle on these */
-
- GIOChannel* input_channel;
+ /* IP MIDI devices need to keep a handle on this and destroy it */
GSource* input_source;
};