Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-02-20 18:06:44 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-02-20 18:09:52 +0300
commitee7c9790a254d2ed70881a4a2c6671c5867f0933 (patch)
treea01326c22dc91ffa171e5ac568fd0ed5e41384e9 /source/blender/editors/space_graph/graph_draw.c
parent7ed5e9f2f78f131aeb9032826a72fe23eaa10b98 (diff)
Fix crash when rendering and drawing curves at the same time
Need to stop modifying original DNA data, this is not safe for threading and easily avoidable.
Diffstat (limited to 'source/blender/editors/space_graph/graph_draw.c')
-rw-r--r--source/blender/editors/space_graph/graph_draw.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 31ea81923da..535ec6e8da9 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -484,10 +484,9 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *ar, FCurve *fcu)
/* Curve ---------------- */
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
-static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid, unsigned int pos)
+static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, View2DGrid *grid, unsigned int pos)
{
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
- ChannelDriver *driver;
float samplefreq;
float stime, etime;
float unitFac, offset;
@@ -502,12 +501,12 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
return;
- /* disable any drivers temporarily */
- driver = fcu->driver;
- fcu->driver = NULL;
+ /* disable any drivers */
+ FCurve fcurve_for_draw = *fcu_;
+ fcurve_for_draw.driver = NULL;
/* compute unit correction factor */
- unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, id, &fcurve_for_draw, mapping_flag, &offset);
/* Note about sampling frequency:
* Ideally, this is chosen such that we have 1-2 pixels = 1 segment
@@ -563,14 +562,11 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d
for (i = 0; i <= n; i++) {
float ctime = stime + i * samplefreq;
- immVertex2f(pos, ctime, (evaluate_fcurve(fcu, ctime) + offset) * unitFac);
+ immVertex2f(pos, ctime, (evaluate_fcurve(&fcurve_for_draw, ctime) + offset) * unitFac);
}
immEnd();
}
-
- /* restore driver */
- fcu->driver = driver;
}
/* helper func - draw a samples-based F-Curve */