Browse Source

libobs: Initialize hotkey pair ID variable properly

The value of 0 can represent a valid hotkey ID, so make sure that when
we initialize a hotkey variable, that we use OBS_INVALID_HOTKEY_ID or
OBS_INVALID_HOTKEY_PAIR_ID and not 0.

This fixes a bug where scene item hotkey pair IDs would be initialized
to 0, and it would unregister valid unrelated hotkeys.  Particularly,
the start/stop streaming hotkey pair ID, which would commonly be the
first hotkey pair created, thus having the hotkey pair ID of 0.  The
start/streaming hotkey pair would unintentionally be unregistered via
code in obs-scene.c.
jp9000 7 years ago
parent
commit
caceb62328
1 changed files with 1 additions and 0 deletions
  1. 1 0
      libobs/obs-scene.c

+ 1 - 0
libobs/obs-scene.c

@@ -1622,6 +1622,7 @@ static obs_sceneitem_t *obs_scene_add_internal(obs_scene_t *scene,
 	item->locked = false;
 	item->is_group = source->info.id == group_info.id;
 	item->private_settings = obs_data_create();
+	item->toggle_visibility = OBS_INVALID_HOTKEY_PAIR_ID;
 	os_atomic_set_long(&item->active_refs, 1);
 	vec2_set(&item->scale, 1.0f, 1.0f);
 	matrix4_identity(&item->draw_transform);