[med-svn] [SCM] aghermann branch, master, updated. 4f7a3b774136ffffbaf9b05d90bd568347bc5461

Andrei Zavada johnhommer at gmail.com
Fri Nov 16 00:50:14 UTC 2012


The following commit has been merged in the master branch:
commit 199014665c23b3556dcb7f015e0e267b94a6cc23
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sun Oct 14 01:50:50 2012 +0300

    fix some spurious dereferencing of userdata in several SF callbacks

diff --git a/src/ui/scoring-facility-artifacts_cb.cc b/src/ui/scoring-facility-artifacts_cb.cc
index e827ff9..5a149c1 100644
--- a/src/ui/scoring-facility-artifacts_cb.cc
+++ b/src/ui/scoring-facility-artifacts_cb.cc
@@ -56,65 +56,69 @@ void
 bSFADApply_clicked_cb( GtkButton*, gpointer userdata)
 {
 	auto& SF = *(SScoringFacility*)userdata;
+	auto& AD = SF.artifact_detection_dialog;
 
 	gtk_widget_hide( (GtkWidget*)SF.wSFArtifactDetectionSetup);
 
-	for ( auto& H : SF.channels_visible_backup )
+	for ( auto& H : AD.channels_visible_backup )
 		H.first->hidden = H.second;
-	SF.channels_visible_backup.clear();
+	AD.channels_visible_backup.clear();
 
-	SF.artifacts_backup.clear_all();
+	AD.artifacts_backup.clear_all();
 }
 
 void
 bSFADCancel_clicked_cb( GtkButton*, gpointer userdata)
 {
 	auto& SF = *(SScoringFacility*)userdata;
+	auto& AD = SF.artifact_detection_dialog;
 
 	gtk_widget_hide( (GtkWidget*)SF.wSFArtifactDetectionSetup);
 
 	if ( gtk_toggle_button_get_active(SF.bSFADPreview) ) {
-		SF.using_channel -> artifacts = SF.artifacts_backup;
+		SF.using_channel -> artifacts = AD.artifacts_backup;
 		SF.using_channel -> get_signal_filtered();
 
 		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 		gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 	}
 
-	for ( auto& H : SF.channels_visible_backup )
+	for ( auto& H : AD.channels_visible_backup )
 		H.first->hidden = H.second;
-	SF.channels_visible_backup.clear();
+	AD.channels_visible_backup.clear();
 
-	SF.artifacts_backup.clear_all();
+	AD.artifacts_backup.clear_all();
 }
 
 void
 bSFADPreview_toggled_cb( GtkToggleButton *b, gpointer userdata)
 {
 	auto& SF = *(SScoringFacility*)userdata;
-	if ( SF.suppress_preview_handler )
+	auto& AD = SF.artifact_detection_dialog;
+
+	if ( AD.suppress_preview_handler )
 		return;
 
 	if ( gtk_toggle_button_get_active(b) ) {
 		aghui::SBusyBlock bb (SF.wSFArtifactDetectionSetup);
-		SF.artifacts_backup = SF.using_channel->artifacts;
+		AD.artifacts_backup = SF.using_channel->artifacts;
 		SF.using_channel -> detect_artifacts( (AD.W_V.down(), AD.P));
 		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFADApply, TRUE);
 
 		if ( gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFADSingleChannelPreview) ) {
-			SF.channels_visible_backup.clear();
+			AD.channels_visible_backup.clear();
 			for ( auto& H : SF.channels ) {
-				SF.channels_visible_backup.emplace_back(
+				AD.channels_visible_backup.emplace_back(
 					&H, H.hidden);
 				if ( &H != SF.using_channel )
 					H.hidden = true;
 			}
 		}  else
-			SF.channels_visible_backup.clear();
+			AD.channels_visible_backup.clear();
 
 	} else {
-		SF.using_channel->artifacts = SF.artifacts_backup;
-		for ( auto& H : SF.channels_visible_backup )
+		SF.using_channel->artifacts = AD.artifacts_backup;
+		for ( auto& H : AD.channels_visible_backup )
 			H.first->hidden = H.second;
 		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFADApply, FALSE);
 	}
diff --git a/src/ui/scoring-facility-filter_cb.cc b/src/ui/scoring-facility-filter_cb.cc
index 0667d8a..f15b309 100644
--- a/src/ui/scoring-facility-filter_cb.cc
+++ b/src/ui/scoring-facility-filter_cb.cc
@@ -75,7 +75,8 @@ void
 eFilterHighPassCutoff_value_changed_cb( GtkSpinButton *spinbutton,
 					gpointer       userdata)
 {
-	auto& FD = *(SScoringFacility::SFiltersDialog*)userdata;
+	auto& SF = *(SScoringFacility*)userdata;
+	auto& FD = SF.filters_dialog;
 	double other_freq = gtk_spin_button_get_value( FD._p.eFilterLowPassCutoff);
 	gtk_widget_set_sensitive( (GtkWidget*)FD._p.bFilterOK,
 				  fdim( other_freq, 0.) < 1e-5 || gtk_spin_button_get_value( spinbutton) < other_freq);
@@ -85,7 +86,8 @@ void
 eFilterLowPassCutoff_value_changed_cb( GtkSpinButton *spinbutton,
 				       gpointer       userdata)
 {
-	auto& FD = *(SScoringFacility::SFiltersDialog*)userdata;
+	auto& SF = *(SScoringFacility*)userdata;
+	auto& FD = SF.filters_dialog;
 	gdouble other_freq = gtk_spin_button_get_value( FD._p.eFilterHighPassCutoff);
 	gtk_widget_set_sensitive( (GtkWidget*)FD._p.bFilterOK,
 				  fdim( other_freq, 0.) < 1e-5 || gtk_spin_button_get_value( spinbutton) > other_freq);
diff --git a/src/ui/scoring-facility-montage_cb.cc b/src/ui/scoring-facility-montage_cb.cc
index fe23ebc..a81729e 100644
--- a/src/ui/scoring-facility-montage_cb.cc
+++ b/src/ui/scoring-facility-montage_cb.cc
@@ -635,6 +635,7 @@ void
 iSFPageDetectArtifacts_activate_cb( GtkMenuItem*, gpointer userdata)
 {
 	auto& SF = *(SScoringFacility*)userdata;
+	auto& AD = SF.artifact_detection_dialog;
 
 	g_signal_emit_by_name( SF.eSFADEstimateE, "toggled");
 	g_signal_emit_by_name( SF.eSFADEstimateE, "toggled");
@@ -642,9 +643,9 @@ iSFPageDetectArtifacts_activate_cb( GtkMenuItem*, gpointer userdata)
 	g_signal_emit_by_name( SF.eSFADUseThisRange, "toggled");
 
 	gtk_widget_set_sensitive( (GtkWidget*)SF.bSFADApply, FALSE);
-	SF.suppress_preview_handler = true;
+	AD.suppress_preview_handler = true;
 	gtk_toggle_button_set_active( SF.bSFADPreview, FALSE);
-	SF.suppress_preview_handler = false;
+	AD.suppress_preview_handler = false;
 
 	snprintf_buf( "Artifact detection in channel %s", SF.using_channel->name);
 	gtk_label_set_text( SF.lSFADInfo, __buf__);

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list