diff --git a/datatypes.h b/datatypes.h index a66c8c7d8..787738e9b 100644 --- a/datatypes.h +++ b/datatypes.h @@ -121,7 +121,7 @@ struct _fft_settings { gfloat fft_pwr_off; struct _fft_alg_data fft_alg_data; struct marker_type *markers; - struct marker_type *markers_copy; + struct marker_type **markers_copy; GMutex *marker_lock; enum marker_types *marker_type; }; @@ -136,7 +136,7 @@ struct _cross_correlation_settings { fftw_complex *signal_b; fftw_complex *xcorr_data; struct marker_type *markers; - struct marker_type *markers_copy; + struct marker_type **markers_copy; GMutex *marker_lock; enum marker_types *marker_type; }; diff --git a/osc.c b/osc.c index cf54278e8..afe682a98 100644 --- a/osc.c +++ b/osc.c @@ -325,10 +325,10 @@ static void do_fft(Transform *tr) } } - if (settings->markers_copy) { - memcpy(settings->markers_copy, settings->markers, + if (*settings->markers_copy) { + memcpy(*settings->markers_copy, settings->markers, sizeof(struct marker_type) * MAX_MARKERS); - settings->markers_copy = NULL; + *settings->markers_copy = NULL; g_mutex_unlock(settings->marker_lock); } } @@ -521,20 +521,20 @@ void cross_correlation_transform_function(Transform *tr, gboolean init_transform if (!tr->has_the_marker) return; - if (MAX_MARKERS && marker_type != MARKER_OFF) + if (MAX_MARKERS && marker_type != MARKER_OFF) { for (j = 0; j <= MAX_MARKERS && markers[j].active; j++) if (marker_type == MARKER_PEAK) { markers[j].x = (gfloat)X[maxx[j]]; markers[j].y = (gfloat)out_data[maxx[j]]; markers[j].bin = maxx[j]; } - - if (settings->markers_copy) { - memcpy(settings->markers_copy, settings->markers, + if (*settings->markers_copy) { + memcpy(*settings->markers_copy, settings->markers, sizeof(struct marker_type) * MAX_MARKERS); - settings->markers_copy = NULL; + *settings->markers_copy = NULL; g_mutex_unlock(settings->marker_lock); } + } } void fft_transform_function(Transform *tr, gboolean init_transform) diff --git a/oscplot.c b/oscplot.c index c32229a3d..63e28afb9 100644 --- a/oscplot.c +++ b/oscplot.c @@ -871,12 +871,12 @@ static void add_markers(OscPlot *plot, Transform *transform) if (priv->active_transform_type == FFT_TRANSFORM || priv->active_transform_type == COMPLEX_FFT_TRANSFORM) { FFT_SETTINGS(transform)->markers = priv->markers; - FFT_SETTINGS(transform)->markers_copy = priv->markers_copy; + FFT_SETTINGS(transform)->markers_copy = &priv->markers_copy; FFT_SETTINGS(transform)->marker_type = &priv->marker_type; FFT_SETTINGS(transform)->marker_lock = &priv->g_marker_copy_lock; } else if (priv->active_transform_type == CROSS_CORRELATION_TRANSFORM) { XCORR_SETTINGS(transform)->markers = priv->markers; - XCORR_SETTINGS(transform)->markers_copy = priv->markers_copy; + XCORR_SETTINGS(transform)->markers_copy = &priv->markers_copy; XCORR_SETTINGS(transform)->marker_type = &priv->marker_type; XCORR_SETTINGS(transform)->marker_lock = &priv->g_marker_copy_lock; }