subparse: don't leak parse context for sami and qttext
In gst_sub_parse_dispose() parser_type will be UNKNOWN, so these deinit calls were never executed. And we should clean up the parser state in the downwards state change anyway.
This commit is contained in:
parent
6cea51c962
commit
3eea81e4a2
@ -93,17 +93,6 @@ gst_sub_parse_dispose (GObject * object)
|
|||||||
|
|
||||||
GST_DEBUG_OBJECT (subparse, "cleaning up subtitle parser");
|
GST_DEBUG_OBJECT (subparse, "cleaning up subtitle parser");
|
||||||
|
|
||||||
switch (subparse->parser_type) {
|
|
||||||
case GST_SUB_PARSE_FORMAT_QTTEXT:
|
|
||||||
qttext_context_deinit (&subparse->state);
|
|
||||||
break;
|
|
||||||
case GST_SUB_PARSE_FORMAT_SAMI:
|
|
||||||
sami_context_deinit (&subparse->state);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subparse->encoding) {
|
if (subparse->encoding) {
|
||||||
g_free (subparse->encoding);
|
g_free (subparse->encoding);
|
||||||
subparse->encoding = NULL;
|
subparse->encoding = NULL;
|
||||||
@ -1161,8 +1150,11 @@ parser_state_dispose (GstSubParse * self, ParserState * state)
|
|||||||
}
|
}
|
||||||
if (state->user_data) {
|
if (state->user_data) {
|
||||||
switch (self->parser_type) {
|
switch (self->parser_type) {
|
||||||
|
case GST_SUB_PARSE_FORMAT_QTTEXT:
|
||||||
|
qttext_context_deinit (state);
|
||||||
|
break;
|
||||||
case GST_SUB_PARSE_FORMAT_SAMI:
|
case GST_SUB_PARSE_FORMAT_SAMI:
|
||||||
sami_context_reset (state);
|
sami_context_deinit (state);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -825,14 +825,16 @@ sami_context_init (ParserState * state)
|
|||||||
GstSamiContext *context;
|
GstSamiContext *context;
|
||||||
|
|
||||||
g_assert (state->user_data == NULL);
|
g_assert (state->user_data == NULL);
|
||||||
state->user_data = (gpointer) g_new0 (GstSamiContext, 1);
|
|
||||||
context = (GstSamiContext *) state->user_data;
|
context = g_new0 (GstSamiContext, 1);
|
||||||
|
|
||||||
context->htmlctxt = html_context_new (&samiParser, context);
|
context->htmlctxt = html_context_new (&samiParser, context);
|
||||||
context->buf = g_string_new ("");
|
context->buf = g_string_new ("");
|
||||||
context->rubybuf = g_string_new ("");
|
context->rubybuf = g_string_new ("");
|
||||||
context->resultbuf = g_string_new ("");
|
context->resultbuf = g_string_new ("");
|
||||||
context->state = g_string_new ("");
|
context->state = g_string_new ("");
|
||||||
|
|
||||||
|
state->user_data = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user