[gegl] Fixed a bug where more threads than GEGL_MAX_THREADS could be set via command line options.



commit 41f32fdccd63d0d445e7dce8c79d7cd8b93cf6a6
Author: Florian Klemme <mail florianklemme de>
Date:   Fri Jan 30 18:11:26 2015 +0100

    Fixed a bug where more threads than GEGL_MAX_THREADS could be set via command line options.

 gegl/gegl-init.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gegl/gegl-init.c b/gegl/gegl-init.c
index 1619fbb..fbfc545 100644
--- a/gegl/gegl-init.c
+++ b/gegl/gegl-init.c
@@ -658,7 +658,15 @@ gegl_post_parse_hook (GOptionContext *context,
         config->tile_height = atoi(str+1);
     }
   if (cmd_gegl_threads)
-    _gegl_threads = atoi (cmd_gegl_threads);
+    {
+      _gegl_threads = atoi (cmd_gegl_threads);
+      if (_gegl_threads > GEGL_MAX_THREADS)
+        {
+          g_warning ("Tried to use %i threads, max is %i",
+                     _gegl_threads, GEGL_MAX_THREADS);
+          _gegl_threads = GEGL_MAX_THREADS;
+        }
+    }
   if (cmd_gegl_disable_opencl)
     gegl_cl_hard_disable ();
 


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