GdsOutputrenderer: progress-changed signal: Status message is now freed inside the GdsOutputRenderer.
This is safe because the signals are handled back to back inside the emit function. Therefore, it can be freed directly after emission. This solves the problem of the status message not being freed if no handler is connected to the signal.
This commit is contained in:
parent
94ac44ddc5
commit
17af08b04d
@ -293,7 +293,7 @@ static void async_rendering_finished_callback(GdsOutputRenderer *renderer, gpoin
|
|||||||
g_object_unref(renderer);
|
g_object_unref(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void async_rendering_status_update_callback(GdsOutputRenderer *renderer, char *status_message, gpointer data)
|
static void async_rendering_status_update_callback(GdsOutputRenderer *renderer, const char *status_message, gpointer data)
|
||||||
{
|
{
|
||||||
GdsRenderGui *gui;
|
GdsRenderGui *gui;
|
||||||
(void)renderer;
|
(void)renderer;
|
||||||
@ -301,7 +301,6 @@ static void async_rendering_status_update_callback(GdsOutputRenderer *renderer,
|
|||||||
gui = RENDERER_GUI(data);
|
gui = RENDERER_GUI(data);
|
||||||
|
|
||||||
activity_bar_set_busy(gui->activity_status_bar, status_message);
|
activity_bar_set_busy(gui->activity_status_bar, status_message);
|
||||||
g_free(status_message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -405,7 +405,7 @@ static gboolean idle_event_processor_callback(gpointer user_data)
|
|||||||
priv = gds_output_renderer_get_instance_private(renderer);
|
priv = gds_output_renderer_get_instance_private(renderer);
|
||||||
|
|
||||||
if (g_mutex_trylock(&priv->idle_function_parameters.message_lock)) {
|
if (g_mutex_trylock(&priv->idle_function_parameters.message_lock)) {
|
||||||
status_message = g_strdup(priv->idle_function_parameters.status_message);
|
status_message = priv->idle_function_parameters.status_message;
|
||||||
g_signal_emit(renderer, gds_output_renderer_signals[ASYNC_PROGRESS_CHANGED], 0, status_message);
|
g_signal_emit(renderer, gds_output_renderer_signals[ASYNC_PROGRESS_CHANGED], 0, status_message);
|
||||||
g_free(priv->idle_function_parameters.status_message);
|
g_free(priv->idle_function_parameters.status_message);
|
||||||
priv->idle_function_parameters.status_message = NULL;
|
priv->idle_function_parameters.status_message = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user