mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 12:52:14 +00:00
pipeline: Ensure the pipeline layer cache is freed when pruning layers
When pruning layers from a pipeline the pipeline cache would once be freed due to the call to pre_change_notify but it would immediately be recreated again when foreach_layer_internal is called. When n_layers is later set to 0 it would end up with an invalid cache lying around. This patch changes the order so that it will iterate the layers first before triggering the pre-change notify so that the cache will be cleared correctly. https://bugzilla.gnome.org/show_bug.cgi?id=683414 Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 1c8efdc838cc5ace380365cb54e0741645856edf)
This commit is contained in:
parent
27d74f09df
commit
a18c97798f
@ -1521,17 +1521,21 @@ _cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n)
|
||||
if (authority->n_layers <= n)
|
||||
return;
|
||||
|
||||
_cogl_pipeline_pre_change_notify (pipeline,
|
||||
COGL_PIPELINE_STATE_LAYERS,
|
||||
NULL,
|
||||
FALSE);
|
||||
|
||||
/* This call to foreach_layer_internal needs to be done before
|
||||
* calling pre_change_notify because it recreates the layer cache.
|
||||
* We are relying on pre_change_notify to clear the layer cache
|
||||
* before we change the number of layers */
|
||||
state.keep_n = n;
|
||||
state.current_pos = 0;
|
||||
_cogl_pipeline_foreach_layer_internal (pipeline,
|
||||
update_prune_layers_info_cb,
|
||||
&state);
|
||||
|
||||
_cogl_pipeline_pre_change_notify (pipeline,
|
||||
COGL_PIPELINE_STATE_LAYERS,
|
||||
NULL,
|
||||
FALSE);
|
||||
|
||||
pipeline->differences |= COGL_PIPELINE_STATE_LAYERS;
|
||||
pipeline->n_layers = n;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user