ref: 6877b7512da0067202dcb3184b9507424210c67f
parent: 58d74cc4fa8f2a0e01e80dd58dec11f2135b0e8d
author: rodri <rgl@antares-labs.eu>
date: Tue Apr 22 17:03:11 EDT 2025
scene: free the lights when clearing the scene
--- a/render.c
+++ b/render.c
@@ -590,7 +590,6 @@
// if(params->job->camera->rendopts & ROAbuff){
// for(i = 0; i < nproc; i++){
// task = _emalloc(sizeof *task);
-// memset(task, 0, sizeof *task);
// params->op = OP_SYNC;
// task->params = params;
// /* TODO the channel is buffered, find another way to sync */
@@ -602,7 +601,6 @@
params->job->ref = nproc;
for(i = 0; i < nproc; i++){
task = _emalloc(sizeof *task);
- memset(task, 0, sizeof *task);
task->params = params;
sendp(taskchans[i], task);
}
@@ -842,8 +840,8 @@
params->job->cliprects = _emalloc(nproc*sizeof(Rectangle));
params->job->ncliprects = nproc;
for(i = 0; i < nproc; i++){
- params->job->cliprects[i].min = Pt(-1,-1);
- params->job->cliprects[i].max = Pt(-1,-1);
+ params->job->cliprects[i].min = (Point){-1,-1};
+ params->job->cliprects[i].max = (Point){-1,-1};
}
}
--- a/scene.c
+++ b/scene.c
@@ -302,11 +302,16 @@
clearscene(Scene *s)
{
Entity *e, *ne;
+ LightSource *l, *nl;
for(e = s->ents.next; e != &s->ents; e = ne){
ne = e->next;
s->delent(s, e);
delentity(e);
+ }
+ for(l = s->lights.next; l != &s->lights; l = nl){
+ nl = l->next;
+ dellight(l);
}
freecubemap(s->skybox);
}