From: ellson Date: Fri, 24 Feb 2006 19:15:02 +0000 (+0000) Subject: fixes to job list processing for multiple window support X-Git-Tag: LAST_LIBGRAPH~32^2~6785 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec3820cdd3ed47e6f0aad7b185d5ab8794c0ae5e;p=graphviz fixes to job list processing for multiple window support --- diff --git a/lib/common/emit.c b/lib/common/emit.c index e6ea28ac1..494b7c603 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -1897,7 +1897,7 @@ extern int gvevent_key_binding_size; int gvRenderJobs (GVC_t * gvc, graph_t * g) { - GVJ_t *job; + GVJ_t *job, *prev_job; if (!GD_drawing(g)) { agerr (AGERR, "Layout was not done. Missing layout plugins? \n"); @@ -1910,7 +1910,8 @@ int gvRenderJobs (GVC_t * gvc, graph_t * g) gvc->keybindings = gvevent_key_binding; gvc->numkeys = gvevent_key_binding_size; - + gvc->active_jobs = NULL; /* clear active list */ + prev_job = NULL; for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) { if (!job->output_file) { /* if not yet opened */ if (job->output_filename == NULL) { @@ -1925,16 +1926,20 @@ int gvRenderJobs (GVC_t * gvc, graph_t * g) return -1; } - if (gvc->active_jobs && strcmp(job->output_langname,gvc->active_jobs->output_langname) != 0) { - /* finalize previous jobs */ - gvdevice_finalize(gvc); - /* clear active list */ - gvc->active_jobs = NULL; + /* if we already have an active job list to a different output device */ + if (gvc->active_jobs + && strcmp(job->output_langname,gvc->active_jobs->output_langname) != 0) { + gvdevice_finalize(gvc); /* finalize previous jobs */ + gvc->active_jobs = NULL; /* clear active list */ + prev_job = NULL; } - /* insert job in active list */ - job->next_active = gvc->active_jobs; - gvc->active_jobs = job; + if (prev_job) + prev_job->next_active = job; /* insert job in active list */ + else + gvc->active_jobs = job; /* first job of new list */ + job->next_active = NULL; /* terminate active list */ + prev_job = job; emit_job(job, g);