Skip to content

Commit

Permalink
Fix #1292 SceneFactory.fromName return exception on duplicate scene (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
avoitenko-logitech authored Jul 24, 2023
1 parent 260df2e commit 8bf1139
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 7 additions & 5 deletions obs-studio-client/source/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,17 @@ Napi::Value osn::Scene::Duplicate(const Napi::CallbackInfo &info)
if (!ValidateResponse(info, response))
return info.Env().Undefined();

uint64_t sourceId = response[1].value_union.ui64;
const auto sourceId = response[1].value_union.ui64;

SourceDataInfo *sdi = new SourceDataInfo;
auto *const sdi = new SourceDataInfo;
sdi->name = name;
sdi->obs_sourceId = "scene";
sdi->id = response[1].value_union.ui64;

sdi->id = sourceId;
CacheManager<SourceDataInfo *>::getInstance().Store(sourceId, name, sdi);
CacheManager<SceneInfo *>::getInstance().Store(sourceId, name, new SceneInfo);

auto *const si = new SceneInfo;
si->id = sourceId;
CacheManager<SceneInfo *>::getInstance().Store(sourceId, name, si);

auto instance = osn::Input::constructor.New({Napi::Number::New(info.Env(), sourceId)});

Expand Down
2 changes: 0 additions & 2 deletions tests/osn-tests/src/test_osn_scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ describe(testName, () => {
});

it('Duplicate scene', () => {
// known bug enable test when fixed
return;
const sceneName = 'duplicate_scene';

// Creating scene
Expand Down

0 comments on commit 8bf1139

Please sign in to comment.