summaryrefslogtreecommitdiff
path: root/cogl/cogl-atlas.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-02-17 13:11:34 +0000
committerNeil Roberts <neil@linux.intel.com>2011-02-17 13:39:30 +0000
commit8f8b05f0e5f6bd3a82abc9355397ef0640934e68 (patch)
tree84f75f31f60b6d259883ca146919b234515462bc /cogl/cogl-atlas.h
parentb77276c99ab70fa6d761edd96efebbe927d6814f (diff)
downloadcogl-8f8b05f0e5f6bd3a82abc9355397ef0640934e68.tar.gz
cogl-atlas-texture: Don't let textures be destroyed during migration
If an atlas texture's last reference is held by the journal or by the last flushed pipeline then if an atlas migration is started it can cause a crash. This is because the atlas migration will cause a journal flush and can sometimes change the current pipeline which means that the texture would be destroyed during migration. This patch adds an extra 'post_reorganize' callback to the existing 'reorganize' callback (which is now renamed to 'pre_reorganize'). The pre_reorganize callback is now called before the atlas grabs a list of the current textures instead of after so that it doesn't matter if the journal flush destroys some of those textures. The pre_reorganize callback for CoglAtlasTexture grabs a reference to all of the textures so that they can not be destroyed when the migration changes the pipeline. In the post_reorganize callback the reference is removed again. http://bugzilla.clutter-project.org/show_bug.cgi?id=2538
Diffstat (limited to 'cogl/cogl-atlas.h')
-rw-r--r--cogl/cogl-atlas.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/cogl/cogl-atlas.h b/cogl/cogl-atlas.h
index 1c5ae30c..72eb8ad8 100644
--- a/cogl/cogl-atlas.h
+++ b/cogl/cogl-atlas.h
@@ -3,7 +3,7 @@
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
- * Copyright (C) 2010 Intel Corporation.
+ * Copyright (C) 2010,2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -55,7 +55,8 @@ struct _CoglAtlas
CoglAtlasUpdatePositionCallback update_position_cb;
- CoglCallbackList reorganize_callbacks;
+ CoglCallbackList pre_reorganize_callbacks;
+ CoglCallbackList post_reorganize_callbacks;
};
CoglAtlas *
@@ -84,12 +85,14 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
void
_cogl_atlas_add_reorganize_callback (CoglAtlas *atlas,
- CoglCallbackListFunc callback,
+ CoglCallbackListFunc pre_callback,
+ CoglCallbackListFunc post_callback,
void *user_data);
void
_cogl_atlas_remove_reorganize_callback (CoglAtlas *atlas,
- CoglCallbackListFunc callback,
+ CoglCallbackListFunc pre_callback,
+ CoglCallbackListFunc post_callback,
void *user_data);
#endif /* __COGL_ATLAS_H */