Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Blender 2.6 Bug Tracker: Browse

[#22040] Crash modifying image while used in (preview) render

Date:
2010-04-15 12:37
Priority:
3
State:
Closed
Submitted by:
Konrad Kleine (kwk)
Assigned to:
Ton Roosendaal (ton)
Category:
Rendering
Status:
Fixed / Closed
Relates to:
Duplicates:
Patches:
 
Summary:
Crash modifying image while used in (preview) render
Detailed description
Hi,

Blender crashes after a few painting strokes. You can open the blend file I attached to repeat the behavior yourself or follow these steps to reproduce this bug.

1. Open Blender with default cube.
2. Unwrap cube.
3. Open UV/Image Editor.
4. Create an image.
5. Assign a texture to the cube's default material.
6. Make the texture an image texture and pick the image you've just created.
7. Ensure the texture preview is "Texture" for now.
8. Paint and be happy (This status is illustrated in the attached screenshot).
9. Now set the texture preview to "Both".
10. Paint a few strokes until blender crashes.

I tried to debug using gdb but after the crash occurs I don't have mouse and keyboard control anymore. To get control back I had to kill gdb from another non-graphical terminal. I would appreciate if someone can point me in the right direction with this debugging issue.

My blender version is this (blender -v):

Blender 2.52 (sub 5) Build
build date: 2010-04-15
build time: 09:54:05
build revision: 28201
build platform: Linux
build type: Debug

It's built using CMake and Unix Makefiles today.

This is my system: Lenovo T500

CPU: Intel(R) Core(TM)2 Duo CPU T9600 @ 2.80GHz
GFX: Mobile 4 Series Chipset Integrated Graphics Controller (Intel)
RAM: 4GB
OS: Ubuntu 10.04 Lucid Lynx Beta 2

Konrad

Followup

Message
  • Date: 2010-04-15 12:52
  • Sender: Konrad Kleine
  • This is the crash message:

    78)]
    0x0873c5eb in ibuf_get_color (col=0xae2d7bcc, ibuf=0xa5baa50, x=204, y=42) at /home/konrad/Dokumente/bf-blender/blender/source/blender/render/intern/source/imagetexture.c:98
    98 col[0] = ((float)rect[0])*(1.0f/255.0f);
  • Date: 2010-04-15 12:53
  • Sender: Konrad Kleine
  • Sorry, there was an error with my paste. Here's the crash message:

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0xae2deb70 (LWP 6178)]
    0x0873c5eb in ibuf_get_color (col=0xae2d7bcc, ibuf=0xa5baa50, x=204, y=42) at /home/konrad/Dokumente/bf-blender/blender/source/blender/render/intern/source/imagetexture.c:98
    98 col[0] = ((float)rect[0])*(1.0f/255.0f);
  • Date: 2010-04-15 14:32
  • Sender: Matt Ebb

  • Ok, confirmed this - the problem here is in paint_image.c: imapaint_image_update() -> imb_freemipmapImBuf().

    When image paint updates the image buffer, it also frees mipmaps associated with that ibuf (since they will be out of date after being modified by painting). If this happens at the same time as the threaded render preview is trying to access mipmaps while rendering, then it will cause the crash.

    Not sure of a good solution here atm, I tried changing the BKE_image_get_ibuf()s in paint_image.c:imapaint_paint_sub_stroke() and imagetexture.c:imagewraposa() to BKE_image_acquire_ibuf() and associated releases but that didn't seem to help. Not sure if that is a bad thing to do at render time either, how much do those locks slow things down?

    Perhaps what should happen is that rather than freeing the mipmaps, they should just be tagged as invalid, then anything that needs to use them eg. render can re-generate new mipmaps where needed at the start of the render process?
  • Date: 2010-12-14 19:03
  • Sender: Ton Roosendaal
  • Thanks for the patience! Fix is in svn for this.

    Solved by adding a flag for remaking mipmaps, and coding a new call to mipmap buffers without re-allocating them.
 

Attached Files:

Name Date Download
paint_and_crash.blend 2010-04-15 12:37 Download
screen1.png 2010-04-15 12:37 Download

Changes:

Field Old Value Date By
StatusReady2010-12-14 19:03ton
status_idOpen2010-12-14 19:03ton
close_dateNone2010-12-14 19:03ton
assigned_toblendix2010-12-07 19:34ton
summaryCrash when painting to texture if texture preview is "both"2010-11-30 07:29blendix
summaryCrash when painting to texture if texture preview is "both"2010-10-23 12:07blendix
CategoryImage & Movie I/O2010-04-15 14:32broken
ResolutionNew2010-04-15 14:32broken
summaryCrash when painting to texture if texture preview is "both"2010-04-15 14:32broken
assigned_tonone2010-04-15 14:32broken
File Added10855: screen1.png2010-04-15 12:37kwk
File Added10854: paint_and_crash.blend2010-04-15 12:37kwk