Author: post
Date: 2012-01-29 16:10:07 +0100 (Sun, 29 Jan 2012)
New Revision: 4111

Modified:
   trunk/plugins/resample/resample.c
Log:
Don't allow resampler settings to change while filter is running.

Modified: trunk/plugins/resample/resample.c
===================================================================
--- trunk/plugins/resample/resample.c   2012-01-22 15:15:56 UTC (rev 4110)
+++ trunk/plugins/resample/resample.c   2012-01-29 15:10:07 UTC (rev 4111)
@@ -92,6 +92,7 @@
 
 static RSFilterClass *rs_resample_parent_class = NULL;
 static inline guint clampbits(gint x, guint n) { guint32 _y_temp; if( 
(_y_temp=x>>n) ) x = ~_y_temp >> (32-n); return x;}
+static GStaticRecMutex resampler_mutex = G_STATIC_REC_MUTEX_INIT;
 
 G_MODULE_EXPORT void
 rs_plugin_load(RSPlugin *plugin)
@@ -187,6 +188,8 @@
        RSResample *resample = RS_RESAMPLE(object);
        RSFilterChangedMask mask = 0;
 
+       g_static_rec_mutex_lock(&resampler_mutex);
+
        switch (property_id)
        {
                case PROP_WIDTH:
@@ -221,6 +224,7 @@
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, 
pspec);
        }
 
+       g_static_rec_mutex_unlock(&resampler_mutex);
        if (mask)
                rs_filter_changed(RS_FILTER(object), mask);
 }
@@ -241,6 +245,7 @@
        gint new_width, new_height;
        gint previous_width = 0;
        gint previous_height = 0;
+       g_static_rec_mutex_lock(&resampler_mutex);
 
        if (RS_FILTER(resample)->previous)
                rs_filter_get_size_simple(RS_FILTER(resample)->previous, 
RS_FILTER_REQUEST_QUICK, &previous_width, &previous_height);
@@ -279,7 +284,7 @@
        if (new_width < 0 || new_height < 0)
                resample->scale = 1.0f;
 
-
+       g_static_rec_mutex_unlock(&resampler_mutex);
        return mask;
 }
 
@@ -400,6 +405,7 @@
        if (!RS_IS_IMAGE16(input))
                return previous_response;
 
+       g_static_rec_mutex_lock(&resampler_mutex);
        input_width = input->w;
        input_height = input->h;        
 
@@ -501,6 +507,7 @@
        rs_filter_response_set_image(response, output);
        rs_filter_param_set_boolean(RS_FILTER_PARAM(response), "half-size", 
FALSE);
        g_object_unref(output);
+       g_static_rec_mutex_unlock(&resampler_mutex);
        return response;
 }
 


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to