Skip to content

Commit 83ea832

Browse files
authored
Merge pull request #2 from MengLi619/fix-restart
Fix restart
2 parents db8f904 + 4d0eb05 commit 83ea832

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obs-node",
3-
"version": "1.0.13",
3+
"version": "1.0.14",
44
"repository": "https://github.com/Mengli619/obs-node.git",
55
"main": "dist/index.js",
66
"scripts": {

src/cpp/source.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,18 @@ void Source::start() {
6969
obs_sceneitem_set_bounds_type(obs_scene_item, OBS_BOUNDS_SCALE_INNER);
7070
obs_sceneitem_set_bounds(obs_scene_item, &bounds);
7171
obs_sceneitem_set_bounds_alignment(obs_scene_item, align);
72-
this->started = true;
72+
started = true;
7373
}
7474

7575
void Source::stop() {
76-
// Call obs_sceneitem_remove but not obs_sceneitem_release to avoid a segfault
76+
// obs_sceneitem_remove will call obs_sceneitem_release internally,
77+
// so it's no need to call obs_sceneitem_release.
7778
obs_sceneitem_remove(obs_scene_item);
7879
obs_source_remove(obs_source);
7980
obs_source_release(obs_source);
8081
obs_source = nullptr;
8182
obs_scene_item = nullptr;
82-
this->started = false;
83+
started = false;
8384
}
8485

8586
Napi::Object Source::getNapiSource(const Napi::Env &env) {

src/cpp/source.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ class Source {
3131
obs_scene_t *obs_scene;
3232
Settings *settings;
3333
obs_source_t *obs_source;
34-
obs_scene_item *obs_scene_item;
34+
obs_sceneitem_t *obs_scene_item;
3535
bool started;
3636
};

0 commit comments

Comments
 (0)