gfx/source-texture: Don't use weak_source for strong references

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2022-12-02 04:39:06 +01:00
parent 7226fe7046
commit 0f4f6d0485
2 changed files with 6 additions and 5 deletions

View file

@ -30,8 +30,8 @@ streamfx::gfx::source_texture::~source_texture()
}
}
streamfx::gfx::source_texture::source_texture(streamfx::obs::weak_source child, streamfx::obs::weak_source parent)
: _parent(parent.lock()), _child(child.lock())
streamfx::gfx::source_texture::source_texture(streamfx::obs::source child, streamfx::obs::source parent)
: _parent(parent), _child(child)
{
// Verify that 'child' and 'parent' exist.
if (!_child || !_parent) {
@ -39,9 +39,9 @@ streamfx::gfx::source_texture::source_texture(streamfx::obs::weak_source child,
}
// Verify that 'child' does not contain 'parent'.
if (::streamfx::obs::tools::source_find_source(_child, _parent)) {
if (::streamfx::obs::tools::source_find_source(child, parent)) {
throw std::runtime_error("Child contains Parent");
} else if (!obs_source_add_active_child(_parent.get(), _child.get())) {
} else if (!obs_source_add_active_child(parent, child)) {
throw std::runtime_error("Child contains Parent");
}

View file

@ -19,6 +19,7 @@
#include "common.hpp"
#include "obs/gs/gs-rendertarget.hpp"
#include "obs/gs/gs-texture.hpp"
#include "obs/obs-source.hpp"
#include "obs/obs-weak-source.hpp"
#include "warning-disable.hpp"
@ -34,7 +35,7 @@ namespace streamfx::gfx {
public:
~source_texture();
source_texture(streamfx::obs::weak_source child, streamfx::obs::weak_source parent);
source_texture(streamfx::obs::source child, streamfx::obs::source parent);
public /*copy*/:
source_texture(source_texture const& other) = delete;