[gimp] plug-ins: fix #5305 Lighting Effects crashes when I use a channel as Bumpmap



commit 7b7d61635891ef7f7d6aee6f8eec3e372c93b8c5
Author: Jacob Boerema <jgboerema gmail com>
Date:   Fri Dec 17 12:05:36 2021 -0500

    plug-ins: fix #5305 Lighting Effects crashes when I use a channel as Bumpmap
    
    When a channel is selected as bumpmap, the bump_format can be different
    than it was before. However, we always kept the first bump_format, which
    could be RGB, in which case trying to use it with a channel caused a
    crash in GIMP.
    
    To fix this we always update the bump_format if bumpmap is enabled.

 plug-ins/lighting/lighting-image.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/lighting/lighting-image.c b/plug-ins/lighting/lighting-image.c
index 7a2c2a4a20..07d712350e 100644
--- a/plug-ins/lighting/lighting-image.c
+++ b/plug-ins/lighting/lighting-image.c
@@ -383,9 +383,12 @@ image_setup (GimpDrawable *drawable,
 void
 bumpmap_setup (GimpDrawable *bumpmap)
 {
-  if (bumpmap && ! bump_buffer)
+  if (bumpmap)
     {
-      bump_buffer = gimp_drawable_get_buffer (bumpmap);
+      if (! bump_buffer)
+        {
+          bump_buffer = gimp_drawable_get_buffer (bumpmap);
+        }
 
       if (gimp_drawable_is_rgb (bumpmap))
         bump_format = babl_format ("R'G'B' u8");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]