GNOME Bugzilla – Bug 777487
GeglNode: Don't emit invalidated before actually setting the passthrough
Last modified: 2017-01-19 12:56:50 UTC
Created attachment 343788 [details] Reproducer Emitting invalidated before the passthrough has been set can cause problems if someone touches the graph in the signal handler. eg., if you set passthrough on a gegl:crop, and call gegl_node_get_bounding_box in the invalidated handler, then the bounding box will still be cropped. It will affect subsequent attempts to get the bounding box, which in turn will also affect attempts to process the graph. See the attached reproducer. In practice it affects the double-buffered rendering in gnome-photos. Instead of directly rendering the main graph, we copy the output into a separate buffer and render from it. If the graph subsequently changes, we wait for the whole thing to be processed before updating the render buffer. This "waiting" has two parts. We query the bounding box of the graph in the invalidated handler, and when it starts emitting "computed", we track the chunks using Cairo regions (cairo_region_equal and cairo_region_union_rectangle). Due to this bug, we get a cropped bounding box in the invalidated handler, and the subsequent processing is thrown off.
Created attachment 343789 [details] [review] GeglNode: Emit invalidated only after setting the passthrough
Created attachment 343795 [details] [review] tests: Bounding box shouldn't be cropped after setting passthrough
Created attachment 343796 [details] [review] tests: Bounding box shouldn't be cropped after setting passthrough Minor style fix.
From #gegl on GIMPNet: 12:49 <rishi> pippin: https://bugzilla.gnome.org/show_bug.cgi?id=777487 12:49 <Wilber> Title: Bug 777487 GeglNode: Don't emit invalidated before actually setting the passthrough (at bugzilla.gnome.org) 12:51 <pippin> rishi: I've tested the fix with gimp (not expecting it to make a difference there, but nevertheless) looks good to me, please push and close :)
Pushed to master.