Improve thread safety in UI code

- Implemented better C++ classes for handling scenes/sources/items in
  obs.hpp, allowing them to automatically increment and decrement the
  references of each, as well as assign them to QVariants.

- Because QVariants are now using the C++ classes, remove the pointer
  QVariant wrapper.

- Use the new C++ classes with the QVariant user data of list box items,
  both for the sake of thread safety and to ensure that the data
  referenced is not freed until removed.  NOTE: still might need some
  testing.

- Implemented a source-remove signal from libobs, and start using that
  signal instead of the source-destroy signal for signalling item
  removal.
This commit is contained in:
jp9000
2014-02-02 14:26:23 -07:00
parent 458325fc6f
commit 6e1dd92f0c
6 changed files with 85 additions and 122 deletions

View File

@@ -199,19 +199,17 @@ obs_scene_t obs_scene_create(const char *name)
int obs_scene_addref(obs_scene_t scene)
{
return obs_source_addref(scene->source);
return scene ? obs_source_addref(scene->source) : 0;
}
int obs_scene_release(obs_scene_t scene)
{
if (scene)
return obs_source_release(scene->source);
return 0;
return scene ? obs_source_release(scene->source) : 0;
}
obs_source_t obs_scene_getsource(obs_scene_t scene)
{
return scene->source;
return scene ? scene->source : NULL;
}
obs_scene_t obs_scene_fromsource(obs_source_t source)