[Bf-blender-cvs] [d71cb229d05] master: Fix T79484: Crash when viewing Movie Clip as a Background Image in a Camera
Lukas Stockner
noreply at git.blender.org
Thu Aug 6 11:58:25 CEST 2020
Commit: d71cb229d054bb0482882fa9c0753b495179d7cb
Author: Lukas Stockner
Date: Wed Aug 5 02:20:59 2020 +0200
Branches: master
https://developer.blender.org/rBd71cb229d054bb0482882fa9c0753b495179d7cb
Fix T79484: Crash when viewing Movie Clip as a Background Image in a Camera
This seems to be caused by a change to the logic of movieclip_get_gputexture_ptr in rB97b597c.
Differential Revision: https://developer.blender.org/D8469
===================================================================
M source/blender/blenkernel/intern/movieclip.c
===================================================================
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 04e61df1173..a5bd2ecf68a 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -1875,24 +1875,28 @@ static GPUTexture **movieclip_get_gputexture_ptr(MovieClip *clip,
MovieClipUser *cuser,
eGPUTextureTarget textarget)
{
- LISTBASE_FOREACH (MovieClip_RuntimeGPUTexture *, tex, &clip->runtime.gputextures) {
+ /* Check if we have an existing entry for that clip user. */
+ MovieClip_RuntimeGPUTexture *tex;
+ for (tex = clip->runtime.gputextures.first; tex; tex = tex->next) {
if (memcmp(&tex->user, cuser, sizeof(MovieClipUser)) == 0) {
- if (tex == NULL) {
- tex = (MovieClip_RuntimeGPUTexture *)MEM_mallocN(sizeof(MovieClip_RuntimeGPUTexture),
- __func__);
+ break;
+ }
+ }
- for (int i = 0; i < TEXTARGET_COUNT; i++) {
- tex->gputexture[i] = NULL;
- }
+ /* If not, allocate a new one. */
+ if (tex == NULL) {
+ tex = (MovieClip_RuntimeGPUTexture *)MEM_mallocN(sizeof(MovieClip_RuntimeGPUTexture),
+ __func__);
- memcpy(&tex->user, cuser, sizeof(MovieClipUser));
- BLI_addtail(&clip->runtime.gputextures, tex);
- }
-
- return &tex->gputexture[textarget];
+ for (int i = 0; i < TEXTARGET_COUNT; i++) {
+ tex->gputexture[i] = NULL;
}
+
+ memcpy(&tex->user, cuser, sizeof(MovieClipUser));
+ BLI_addtail(&clip->runtime.gputextures, tex);
}
- return NULL;
+
+ return &tex->gputexture[textarget];
}
GPUTexture *BKE_movieclip_get_gpu_texture(MovieClip *clip, MovieClipUser *cuser)
More information about the Bf-blender-cvs
mailing list