mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 06:36:01 +01:00
Mark the request as done in the signal emitter
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
9e77b26a3d
commit
08a87f679e
1 changed files with 23 additions and 12 deletions
35
render.c
35
render.c
|
@ -349,10 +349,8 @@ render_job(void* data, void* user_data)
|
||||||
if (render(request, renderer) != true) {
|
if (render(request, renderer) != true) {
|
||||||
girara_error("Rendering failed (page %d)\n", zathura_page_get_index(request_priv->page) + 1);
|
girara_error("Rendering failed (page %d)\n", zathura_page_get_index(request_priv->page) + 1);
|
||||||
}
|
}
|
||||||
request_priv->requested = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
color2double(const GdkColor* col, double* v)
|
color2double(const GdkColor* col, double* v)
|
||||||
{
|
{
|
||||||
|
@ -407,6 +405,7 @@ colorumax(const double* h, double l, double l1, double l2)
|
||||||
|
|
||||||
typedef struct emit_completed_signal_s
|
typedef struct emit_completed_signal_s
|
||||||
{
|
{
|
||||||
|
ZathuraRenderer* renderer;
|
||||||
ZathuraRenderRequest* request;
|
ZathuraRenderRequest* request;
|
||||||
cairo_surface_t* surface;
|
cairo_surface_t* surface;
|
||||||
} emit_completed_signal_t;
|
} emit_completed_signal_t;
|
||||||
|
@ -415,11 +414,22 @@ static gboolean
|
||||||
emit_completed_signal(void* data)
|
emit_completed_signal(void* data)
|
||||||
{
|
{
|
||||||
emit_completed_signal_t* ecs = data;
|
emit_completed_signal_t* ecs = data;
|
||||||
/* emit the signal */
|
private_t* priv = GET_PRIVATE(ecs->renderer);
|
||||||
g_signal_emit(ecs->request, request_signals[REQUEST_COMPLETED], 0, ecs->surface);
|
request_private_t* request_priv = REQUEST_GET_PRIVATE(ecs->request);
|
||||||
|
|
||||||
|
if (priv->about_to_close == false && request_priv->aborted == false) {
|
||||||
|
/* emit the signal */
|
||||||
|
g_signal_emit(ecs->request, request_signals[REQUEST_COMPLETED], 0, ecs->surface);
|
||||||
|
}
|
||||||
|
/* mark the request as done */
|
||||||
|
request_priv->requested = false;
|
||||||
|
|
||||||
/* clean up the data */
|
/* clean up the data */
|
||||||
cairo_surface_destroy(ecs->surface);
|
cairo_surface_destroy(ecs->surface);
|
||||||
|
g_object_unref(ecs->renderer);
|
||||||
|
g_object_unref(ecs->request);
|
||||||
g_free(ecs);
|
g_free(ecs);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,15 +560,16 @@ render(ZathuraRenderRequest* request, ZathuraRenderer* renderer)
|
||||||
#undef rgb2
|
#undef rgb2
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->about_to_close == false && request_priv->aborted == false) {
|
emit_completed_signal_t* ecs = g_malloc(sizeof(ecs));
|
||||||
emit_completed_signal_t* ecs = g_malloc(sizeof(ecs));
|
ecs->renderer = renderer;
|
||||||
ecs->request = request;
|
ecs->request = request;
|
||||||
ecs->surface = surface;
|
ecs->surface = surface;
|
||||||
cairo_surface_reference(surface);
|
g_object_ref(renderer);
|
||||||
|
g_object_ref(request);
|
||||||
|
cairo_surface_reference(surface);
|
||||||
|
|
||||||
/* emit signal from the main context, i.e. the main thread */
|
/* emit signal from the main context, i.e. the main thread */
|
||||||
g_main_context_invoke(NULL, emit_completed_signal, ecs);
|
g_main_context_invoke(NULL, emit_completed_signal, ecs);
|
||||||
}
|
|
||||||
|
|
||||||
cairo_surface_destroy(surface);
|
cairo_surface_destroy(surface);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue