Commit 8c9f404f authored by Brandon Invergo's avatar Brandon Invergo

Fix adding procedures to existing hook handlers

parent 8eb69ce6
2019-07-08 Brandon Invergo <brandon@invergo.net>
* src/librekontrol-core.c (get_exit_handler): Fix failure when
trying to add a procedure to an existing exit hook.
(get_idle_handler): Fix failure when trying to add a procedure to
an existing idle hook.
2019-04-11 Brandon Invergo <b.invergo@exeter.ac.uk>
* src/lk-device.c (open_device): Allow opening a MIDI sequencer
......
......@@ -1123,15 +1123,18 @@ get_idle_handler (SCM lk_device_s, bool create)
s_idle_hand_symbol = scm_c_lookup ("lk-idle-handlers");
s_idle_handlers = scm_variable_ref (s_idle_hand_symbol);
s_dev_handler = scm_hash_ref (s_idle_handlers, s_dev_id, SCM_UNDEFINED);
if (scm_is_false (s_dev_handler) && create)
if (scm_is_false (s_dev_handler))
{
s_dev_handler = scm_make_hook (scm_from_int(0));
scm_hash_set_x (s_idle_handlers, s_dev_id, s_dev_handler);
}
else
{
error (0, 0, _("No idle-handler for device: %s"), device->id);
return SCM_BOOL_F;
if (create)
{
s_dev_handler = scm_make_hook (scm_from_int(0));
scm_hash_set_x (s_idle_handlers, s_dev_id, s_dev_handler);
}
else
{
error (0, 0, _("No idle-handler for device: %s"), device->str_id);
return SCM_BOOL_F;
}
}
return s_dev_handler;
}
......@@ -1225,15 +1228,18 @@ get_exit_handler (SCM lk_device_s, bool create)
s_exit_hand_symbol = scm_c_lookup ("lk-exit-handlers");
s_exit_handlers = scm_variable_ref (s_exit_hand_symbol);
s_dev_handler = scm_hash_ref (s_exit_handlers, s_dev_id, SCM_UNDEFINED);
if (scm_is_false (s_dev_handler) && create)
if (scm_is_false (s_dev_handler))
{
s_dev_handler = scm_make_hook (scm_from_int(0));
scm_hash_set_x (s_exit_handlers, s_dev_id, s_dev_handler);
}
else
{
error (0, 0, _("No exit-handler for device: %s"), device->id);
return SCM_BOOL_F;
if (create)
{
s_dev_handler = scm_make_hook (scm_from_int(0));
scm_hash_set_x (s_exit_handlers, s_dev_id, s_dev_handler);
}
else
{
error (0, 0, _("No exit-handler for device: %s"), device->str_id);
return SCM_BOOL_F;
}
}
return s_dev_handler;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment