Skip to content

Commit

Permalink
Merge pull request media-kit#319 from media-kit/fix/memory-leaks
Browse files Browse the repository at this point in the history
fix: memory leaks
  • Loading branch information
alexmercerind authored Aug 3, 2023
2 parents e5ab431 + 52e2fa5 commit 689b97c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 6 additions & 5 deletions media_kit_video/linux/video_output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,11 @@ VideoOutput* video_output_new(FlTextureRegistrar* texture_registrar,
// for slowing the UI thread as little as possible. It's a pity
// that software rendering is feeling faster than hardware
// rendering due to fucked-up GTK.
g_thread_new(
"mpv_render_context_set_update_callback",
[](gpointer data) -> gpointer {
gdk_threads_add_idle(
[](gpointer data) -> gboolean {
VideoOutput* self = (VideoOutput*)data;
if (self->destroyed) {
return NULL;
return FALSE;
}
g_mutex_lock(&self->mutex);
gint64 width = video_output_get_width(self);
Expand All @@ -218,7 +217,7 @@ VideoOutput* video_output_new(FlTextureRegistrar* texture_registrar,
FL_TEXTURE(self->texture_sw));
}
g_mutex_unlock(&self->mutex);
return NULL;
return FALSE;
},
data);
},
Expand Down Expand Up @@ -313,6 +312,7 @@ gint64 video_output_get_width(VideoOutput* self) {
}
}
}
mpv_free_node_contents(&params);
}

width = rotate == 0 || rotate == 180 ? dw : dh;
Expand Down Expand Up @@ -362,6 +362,7 @@ gint64 video_output_get_height(VideoOutput* self) {
}
}
}
mpv_free_node_contents(&params);
}

width = rotate == 0 || rotate == 180 ? dw : dh;
Expand Down
2 changes: 2 additions & 0 deletions media_kit_video/windows/video_output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ int64_t VideoOutput::GetVideoWidth() {
}
}
}
mpv_free_node_contents(&params);
}

width = rotate == 0 || rotate == 180 ? dw : dh;
Expand Down Expand Up @@ -440,6 +441,7 @@ int64_t VideoOutput::GetVideoHeight() {
}
}
}
mpv_free_node_contents(&params);
}

width = rotate == 0 || rotate == 180 ? dw : dh;
Expand Down

0 comments on commit 689b97c

Please sign in to comment.