libobs: Fix bug where outputs cannot initialize hotkeys

When an output's context data is being created, it cannot register any
hotkeys because the output has not initialized its reference counting
capability.  This is due to the fact that when a hotkey is registered,
it creates a weak reference to the source/output/service/encoder.

The solution to this is to make sure the output's reference counter data
is created before calling the create callback.
This commit is contained in:
jp9000 2016-12-07 02:55:06 -08:00
parent b277000f97
commit ec4317dd2b

View File

@ -129,12 +129,6 @@ obs_output_t *obs_output_create(const char *id, const char *name,
if (ret < 0)
goto fail;
if (info)
output->context.data = info->create(output->context.settings,
output);
if (!output->context.data)
blog(LOG_ERROR, "Failed to create output '%s'!", name);
output->reconnect_retry_sec = 2;
output->reconnect_retry_max = 20;
output->valid = true;
@ -146,6 +140,12 @@ obs_output_t *obs_output_create(const char *id, const char *name,
&obs->data.outputs_mutex,
&obs->data.first_output);
if (info)
output->context.data = info->create(output->context.settings,
output);
if (!output->context.data)
blog(LOG_ERROR, "Failed to create output '%s'!", name);
blog(LOG_DEBUG, "output '%s' (%s) created", name, id);
return output;