Page MenuHome

Crash showing scopes
Closed, ResolvedPublic

Description

System Information
Windows 8.0
Intel HD 4600

Blender Version
Broken: After rB774e034d40f9494a2523076992fc19e534ecfb17
Worked: Before rB774e034d40f9494a2523076992fc19e534ecfb17

Short description of error
Opening tool shelf causes crash

Exact steps for others to reproduce the error

  1. Open an image in image editor
  2. Hit T If not an immediate crash play with scope settings

Event Timeline

Aaron Carlisle (Blendify) set Type to Bug.
Aaron Carlisle (Blendify) created this task.
Aaron Carlisle (Blendify) raised the priority of this task from to Needs Triage by Developer.
Campbell Barton (campbellbarton) renamed this task from Blender Crash to Crash showing scopes.Jun 15 2015, 8:08 PM
Bastien Montagne (mont29) renamed this task from Crash showing scopes to Blender Crash when showing scopes in image editor (with image loaded).
Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.
Campbell Barton (campbellbarton) renamed this task from Blender Crash when showing scopes in image editor (with image loaded) to Crash showing scopes.

(lldb) bt

  • thread #1: tid = 0x4e8b5, 0x0000000100f09f81 blender`save_sample_line(scopes=0x000000010e121668, idx=93182, fx=0.532291651, rgb=0x00007fff5fbadd90, ycc=0x00007fff5fbadd84) + 97 at colortools.c:943, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x12c005000)
    • frame #0: 0x0000000100f09f81 blender`save_sample_line(scopes=0x000000010e121668, idx=93182, fx=0.532291651, rgb=0x00007fff5fbadd90, ycc=0x00007fff5fbadd84) + 97 at colortools.c:943 frame #1: 0x0000000100f09783 blender`scopes_update(scopes=0x000000010e121668, ibuf=0x000000010fc86608, view_settings=0x000000010e1362a8, display_settings=0x000000010e136348) + 3635 at colortools.c:1187 frame #2: 0x00000001001ae23f blender`ED_space_image_scopes_update(C=0x00006080000c0078, sima=0x000000010e121608, ibuf=0x000000010fc86608, use_view_settings=true) + 223 at image_edit.c:305 frame #3: 0x00000001001bba49 blender`image_tools_area_draw(C=0x00006080000c0078, ar=0x000000010e84d078) + 233 at space_image.c:904 frame #4: 0x000000010073e725 blender`ED_region_do_draw(C=0x00006080000c0078, ar=0x000000010e84d078) + 549 at area.c:517 frame #5: 0x00000001001339c4 blender`wm_method_draw_triple(C=0x00006080000c0078, win=0x000000010e837b68) + 612 at wm_draw.c:640 frame #6: 0x0000000100132bcf blender`wm_draw_update(C=0x00006080000c0078) + 399 at wm_draw.c:1047 frame #7: 0x00000001001308c0 blender`WM_main(C=0x00006080000c0078) + 48 at wm.c:493 frame #8: 0x000000010012be09 blender`main(argc=1, argv=0x00007fff5fbff490) + 1497 at creator.c:1917 frame #9: 0x000000010012b81c blender`start + 52

(lldb)

ideasman proposal to change line 1096 in colortools.c to:

rows_per_sample_line = (ibuf->y / scopes->sample_lines) +1;

fixes the crash.

Jens

Previous fix wasn't right, was just a guess.
rows_per_sample_line = (ibuf->y / scopes->sample_lines) +1;

Reasoning is,
ibuf->y / scopes->sample_lines will be 1 with full samples, +1 will make it 2. And its obviosly wrong to have a value of 2 when we want to read every scanline.

AFAICS the issue is to do with reading the end of the image which doesn't fit into the stride size.

This works correctly in my tests (one byte past this is always out of bounds, so it writes right up until the endpoint).

1diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
2index 9cce929..7fce5a6 100644
3--- a/source/blender/blenkernel/intern/colortools.c
4+++ b/source/blender/blenkernel/intern/colortools.c
5@@ -1056,6 +1056,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
6 void *cache_handle = NULL;
7 struct ColormanageProcessor *cm_processor = NULL;
8 int rows_per_sample_line;
9+ int ibuf_y_scan;
10
11 if (ibuf->rect == NULL && ibuf->rect_float == NULL) return;
12
13@@ -1125,9 +1126,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
14 &cache_handle);
15 }
16
17+ /* account for rounding */
18+ ibuf_y_scan = rows_per_sample_line * scopes->sample_lines;
19+
20 /* Keep number of threads in sync with the merge parts below. */
21 #pragma omp parallel for private(y) schedule(static) num_threads(num_threads) if(ibuf->y > 256)
22- for (y = 0; y < ibuf->y; y++) {
23+ for (y = 0; y < ibuf_y_scan; y++) {
24 #ifdef _OPENMP
25 const int thread_idx = omp_get_thread_num();
26 #else