diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-27 10:06:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-27 10:06:35 +0400 |
commit | ac0a8af41413b730c0ab17cf19390c65dee3134c (patch) | |
tree | 2dd171dae5a4d56b4eb68590808cb62ad8f1696d | |
parent | 9c6deff652d498501d7065e77cdbacfb6478c370 (diff) |
fix [#35518] UV Mapping crashes the Blender with specific image file
2 bugs here
- missing NULL check in IMB_colormanagement_display_settings_from_ctx()
- deadlock in draw_image_paint_helpers()
Simple solution is to not draw paint helpers for render/viewer images.
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 9 | ||||
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index ba12543ff50..23c85699b00 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -783,7 +783,7 @@ void draw_image_main(const bContext *C, ARegion *ar) Image *ima; ImBuf *ibuf; float zoomx, zoomy; - int show_viewer, show_render; + bool show_viewer, show_render, show_paint; void *lock; /* XXX can we do this in refresh? */ @@ -810,8 +810,9 @@ void draw_image_main(const bContext *C, ARegion *ar) ima = ED_space_image(sima); ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy); - show_viewer = (ima && ima->source == IMA_SRC_VIEWER); - show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT); + show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0; + show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0; + show_paint = (ima && (sima->mode == SI_MODE_PAINT) && (show_viewer == false) && (show_render == false)); if (show_viewer) { /* use locked draw for drawing viewer image buffer since the compositor @@ -835,7 +836,7 @@ void draw_image_main(const bContext *C, ARegion *ar) draw_image_buffer(C, sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy); /* paint helpers */ - if (sima->mode == SI_MODE_PAINT) + if (show_paint) draw_image_paint_helpers(C, ar, scene, zoomx, zoomy); /* XXX integrate this code */ diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 78eb5eeb65b..235c6a0f37e 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -672,7 +672,7 @@ void IMB_colormanagement_display_settings_from_ctx(const bContext *C, *view_settings_r = &scene->view_settings; *display_settings_r = &scene->display_settings; - if (sima) { + if (sima && sima->image) { if ((sima->image->flag & IMA_VIEW_AS_RENDER) == 0) *view_settings_r = NULL; } |