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
This commit is contained in:
parent
3439cbcc69
commit
d71cb229d0
Notes:
blender-bot
2023-02-14 11:28:39 +01:00
Referenced by issue #79484, SEGFAULT when viewing Movie Clip as a Background Image in a Camera
|
@ -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__);
|
||||
|
||||
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 &tex->gputexture[textarget];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
/* If not, allocate a new one. */
|
||||
if (tex == NULL) {
|
||||
tex = (MovieClip_RuntimeGPUTexture *)MEM_mallocN(sizeof(MovieClip_RuntimeGPUTexture),
|
||||
__func__);
|
||||
|
||||
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 &tex->gputexture[textarget];
|
||||
}
|
||||
|
||||
GPUTexture *BKE_movieclip_get_gpu_texture(MovieClip *clip, MovieClipUser *cuser)
|
||||
|
|
Loading…
Reference in New Issue