[glom/glom-1-24] More fixes for clang compiler and analyzer warnings.



commit 3198f3cab87eab56f5945e6be227d5b6bb9275b4
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Oct 15 13:11:25 2013 +0200

    More fixes for clang compiler and analyzer warnings.

 glom/mode_design/fields/dialog_fielddefinition.cc  |   10 +++--
 .../layout/dialog_layout_calendar_related.cc       |   24 +++++++++----
 .../print_layouts/dialog_text_formatting.cc        |   14 ++++++--
 .../report_layout/dialog_layout_report.cc          |    3 ++
 .../translation/dialog_change_language.cc          |    4 +-
 .../translation/dialog_copy_translation.cc         |    4 +-
 .../translation/dialog_identify_original.cc        |    4 +-
 .../mode_design/translation/window_translations.cc |   35 ++++++++++++++++----
 tests/test_selfhosting_new_then_image.cc           |    6 +++
 9 files changed, 76 insertions(+), 28 deletions(-)
---
diff --git a/glom/mode_design/fields/dialog_fielddefinition.cc 
b/glom/mode_design/fields/dialog_fielddefinition.cc
index 693a894..2b8c61f 100644
--- a/glom/mode_design/fields/dialog_fielddefinition.cc
+++ b/glom/mode_design/fields/dialog_fielddefinition.cc
@@ -101,12 +101,14 @@ Dialog_FieldDefinition::Dialog_FieldDefinition(BaseObjectType* cobject, const Gl
   on_foreach_connect(*m_pBox_DefaultValueSimple);
   on_foreach_connect(*m_pBox_ValueTab);
 
-  if(m_box_formatting) ////Unlikely to fail and it already warns on stderr.
+  if(m_box_formatting)
+  {
     on_foreach_connect(*m_box_formatting);
 
-  //Plus an extra signal for the related extra show-also fields:
-  m_box_formatting->signal_modified().connect(
-   sigc::mem_fun(*this, &Dialog_FieldDefinition::on_anything_changed));
+    //Plus an extra signal for the related extra show-also fields:
+    m_box_formatting->signal_modified().connect(
+     sigc::mem_fun(*this, &Dialog_FieldDefinition::on_anything_changed));
+  }
 
   Dialog_Properties::set_modified(false);
 
diff --git a/glom/mode_design/layout/dialog_layout_calendar_related.cc 
b/glom/mode_design/layout/dialog_layout_calendar_related.cc
index 5353fbf..ec6bb11 100644
--- a/glom/mode_design/layout/dialog_layout_calendar_related.cc
+++ b/glom/mode_design/layout/dialog_layout_calendar_related.cc
@@ -51,11 +51,16 @@ Dialog_Layout_Calendar_Related::Dialog_Layout_Calendar_Related(BaseObjectType* c
   m_box_related_navigation->show();
 
   builder->get_widget_derived("combo_relationship_name", m_combo_relationship);
-  m_combo_relationship->signal_changed().connect(sigc::mem_fun(*this, 
&Dialog_Layout_Calendar_Related::on_combo_relationship_changed));
+  if(m_combo_relationship)
+  {
+    m_combo_relationship->signal_changed().connect(sigc::mem_fun(*this, 
&Dialog_Layout_Calendar_Related::on_combo_relationship_changed));
+  }
 
   builder->get_widget("checkbutton_show_child_relationships", m_checkbutton_show_child_relationships);
-  m_checkbutton_show_child_relationships->signal_toggled().connect(sigc::mem_fun(*this, 
&Dialog_Layout_Calendar_Related::on_checkbutton_show_child_relationships));
-
+  if(m_checkbutton_show_child_relationships)
+  {
+    m_checkbutton_show_child_relationships->signal_toggled().connect(sigc::mem_fun(*this, 
&Dialog_Layout_Calendar_Related::on_checkbutton_show_child_relationships));
+  }
 
 
   builder->get_widget("radiobutton_navigation_automatic", m_radio_navigation_automatic);
@@ -64,12 +69,17 @@ Dialog_Layout_Calendar_Related::Dialog_Layout_Calendar_Related(BaseObjectType* c
 
   builder->get_widget("radiobutton_navigation_specify", m_radio_navigation_specify);
   builder->get_widget_derived("combobox_navigation_specify", m_combo_navigation_specify);
-  make_sensitivity_depend_on_toggle_button(*m_radio_navigation_specify, *m_combo_navigation_specify);
-  m_combo_navigation_specify->signal_changed().connect(sigc::mem_fun(*this, 
&Dialog_Layout_Calendar_Related::on_combo_navigation_specific_changed));
+  if(m_radio_navigation_specify && m_combo_navigation_specify)
+  { 
+    make_sensitivity_depend_on_toggle_button(*m_radio_navigation_specify, *m_combo_navigation_specify);
+    m_combo_navigation_specify->signal_changed().connect(sigc::mem_fun(*this, 
&Dialog_Layout_Calendar_Related::on_combo_navigation_specific_changed));
+  }
 
   builder->get_widget_derived("combobox_date_field", m_combobox_date_field);
-  m_combobox_date_field->signal_changed().connect(sigc::mem_fun(*this, 
&Dialog_Layout_Calendar_Related::on_combo_date_field_changed));
-
+  if(m_combobox_date_field)
+  {
+    m_combobox_date_field->signal_changed().connect(sigc::mem_fun(*this, 
&Dialog_Layout_Calendar_Related::on_combo_date_field_changed));
+  }
 
   m_modified = false;
 
diff --git a/glom/mode_design/print_layouts/dialog_text_formatting.cc 
b/glom/mode_design/print_layouts/dialog_text_formatting.cc
index 02dc9c1..0de1b5d 100644
--- a/glom/mode_design/print_layouts/dialog_text_formatting.cc
+++ b/glom/mode_design/print_layouts/dialog_text_formatting.cc
@@ -36,16 +36,22 @@ Dialog_TextFormatting::Dialog_TextFormatting(BaseObjectType* cobject, const Glib
 {
   Gtk::Button* button_close = 0;
   builder->get_widget("button_close",  button_close);
-  button_close->signal_clicked().connect( sigc::mem_fun(*this, &Dialog_TextFormatting::on_button_close) );
+  if(button_close)
+  {
+    button_close->signal_clicked().connect( sigc::mem_fun(*this, &Dialog_TextFormatting::on_button_close) );
+  }
 
   //Formatting:
   //Get the place to put the Formatting stuff:
   builder->get_widget("box_formatting_placeholder", m_box_formatting_placeholder);
  
   Utils::get_glade_child_widget_derived_with_warning(m_box_formatting);
-  m_box_formatting_placeholder->pack_start(*m_box_formatting);
-  add_view(m_box_formatting);
-  m_box_formatting->set_is_for_non_editable();
+  if(m_box_formatting)
+  {
+    m_box_formatting_placeholder->pack_start(*m_box_formatting);
+    add_view(m_box_formatting);
+    m_box_formatting->set_is_for_non_editable();
+  }
 
   set_modal(); //We don't want people to edit the main window while we are changing structure.
 
diff --git a/glom/mode_design/report_layout/dialog_layout_report.cc 
b/glom/mode_design/report_layout/dialog_layout_report.cc
index 8d6fc1f..214eec7 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.cc
+++ b/glom/mode_design/report_layout/dialog_layout_report.cc
@@ -895,6 +895,9 @@ void Dialog_Layout_Report::on_button_edit()
               {
                 Dialog_GroupBy* dialog = 0;
                 Utils::get_glade_widget_derived_with_warning(dialog);
+                if(!dialog)
+                  return;
+
                 add_view(dialog);
                 dialog->set_item(group_by, m_table_name);
                 dialog->set_transient_for(*this);
diff --git a/glom/mode_design/translation/dialog_change_language.cc 
b/glom/mode_design/translation/dialog_change_language.cc
index 5cafb98..823dfc3 100644
--- a/glom/mode_design/translation/dialog_change_language.cc
+++ b/glom/mode_design/translation/dialog_change_language.cc
@@ -33,8 +33,8 @@ Dialog_ChangeLanguage::Dialog_ChangeLanguage(BaseObjectType* cobject, const Glib
   m_combo_locale(0)
 {
   builder->get_widget_derived("combobox_locale", m_combo_locale);
-
-  m_combo_locale->set_selected_locale(AppWindow::get_current_locale());
+  if(m_combo_locale)
+    m_combo_locale->set_selected_locale(AppWindow::get_current_locale());
 }
 
 Dialog_ChangeLanguage::~Dialog_ChangeLanguage()
diff --git a/glom/mode_design/translation/dialog_copy_translation.cc 
b/glom/mode_design/translation/dialog_copy_translation.cc
index aab5963..9a69866 100644
--- a/glom/mode_design/translation/dialog_copy_translation.cc
+++ b/glom/mode_design/translation/dialog_copy_translation.cc
@@ -34,8 +34,8 @@ Dialog_CopyTranslation::Dialog_CopyTranslation(BaseObjectType* cobject, const Gl
   m_combo_locale(0)
 {
   builder->get_widget_derived("combobox_locale", m_combo_locale);
-
-  m_combo_locale->set_selected_locale(AppWindow::get_current_locale());
+  if(m_combo_locale)
+    m_combo_locale->set_selected_locale(AppWindow::get_current_locale());
 }
 
 Dialog_CopyTranslation::~Dialog_CopyTranslation()
diff --git a/glom/mode_design/translation/dialog_identify_original.cc 
b/glom/mode_design/translation/dialog_identify_original.cc
index d44f4d3..b307273 100644
--- a/glom/mode_design/translation/dialog_identify_original.cc
+++ b/glom/mode_design/translation/dialog_identify_original.cc
@@ -39,8 +39,8 @@ Dialog_IdentifyOriginal::Dialog_IdentifyOriginal(BaseObjectType* cobject, const
 {
   builder->get_widget("label_original", m_label_original);
   builder->get_widget_derived("combobox_locale", m_combo_locale);
-
-  m_combo_locale->set_selected_locale(AppWindow::get_current_locale());
+  if(m_combo_locale)
+    m_combo_locale->set_selected_locale(AppWindow::get_current_locale());
 }
 
 Dialog_IdentifyOriginal::~Dialog_IdentifyOriginal()
diff --git a/glom/mode_design/translation/window_translations.cc 
b/glom/mode_design/translation/window_translations.cc
index f1e5bad..97ca390 100644
--- a/glom/mode_design/translation/window_translations.cc
+++ b/glom/mode_design/translation/window_translations.cc
@@ -85,25 +85,46 @@ Window_Translations::Window_Translations(BaseObjectType* cobject, const Glib::Re
   }
 
   builder->get_widget("button_identify", m_button_identify);
-  m_button_identify->signal_clicked().connect( sigc::mem_fun(*this, 
&Window_Translations::on_button_identify) );
+  if(m_button_identify)
+  {
+    m_button_identify->signal_clicked().connect( sigc::mem_fun(*this, 
&Window_Translations::on_button_identify) );
+  }
 
   builder->get_widget_derived("combobox_target_locale", m_combo_target_locale);
-  m_combo_target_locale->signal_changed().connect(sigc::mem_fun(*this, 
&Window_Translations::on_combo_target_locale_changed));
+  if(m_combo_target_locale)
+  {
+    m_combo_target_locale->signal_changed().connect(sigc::mem_fun(*this, 
&Window_Translations::on_combo_target_locale_changed));
+  }
 
   builder->get_widget("button_ok", m_button_ok);
-  m_button_ok->signal_clicked().connect( sigc::mem_fun(*this, &Window_Translations::on_button_ok) );
+  if(m_button_ok)
+  {
+    m_button_ok->signal_clicked().connect( sigc::mem_fun(*this, &Window_Translations::on_button_ok) );
+  }
 
   builder->get_widget("button_cancel", m_button_cancel);
-  m_button_cancel->signal_clicked().connect( sigc::mem_fun(*this, &Window_Translations::on_button_cancel) );
+  if(m_button_cancel)
+  {
+    m_button_cancel->signal_clicked().connect( sigc::mem_fun(*this, &Window_Translations::on_button_cancel) 
);
+  }
 
   builder->get_widget("button_copy_translation", m_button_copy_translation);
-  m_button_copy_translation->signal_clicked().connect( sigc::mem_fun(*this, 
&Window_Translations::on_button_copy_translation) );
+  if(m_button_copy_translation)
+  {
+    m_button_copy_translation->signal_clicked().connect( sigc::mem_fun(*this, 
&Window_Translations::on_button_copy_translation) );
+  }
 
   builder->get_widget("button_import", m_button_import);
-  m_button_import->signal_clicked().connect( sigc::mem_fun(*this, &Window_Translations::on_button_import) );
+  if(m_button_import)
+  {
+    m_button_import->signal_clicked().connect( sigc::mem_fun(*this, &Window_Translations::on_button_import) 
);
+  }
 
   builder->get_widget("button_export", m_button_export);
-  m_button_export->signal_clicked().connect( sigc::mem_fun(*this, &Window_Translations::on_button_export) );
+  if(m_button_export)
+  {
+    m_button_export->signal_clicked().connect( sigc::mem_fun(*this, &Window_Translations::on_button_export) 
);
+  }
 
   show_all_children();
 
diff --git a/tests/test_selfhosting_new_then_image.cc b/tests/test_selfhosting_new_then_image.cc
index 59dfd6d..6d79e7d 100644
--- a/tests/test_selfhosting_new_then_image.cc
+++ b/tests/test_selfhosting_new_then_image.cc
@@ -126,6 +126,12 @@ static bool test(Glom::Document::HostingMode hosting_mode)
   }
 
   const GdaBinary* binary_set = gda_value_get_binary(value_set.gobj());
+  if(!binary_set)
+  {
+    std::cerr << "Failure: The value read's data was null." << std::endl;
+    return false;
+  }
+
   if(binary_set->binary_length != binary_read->binary_length)
   {
     std::cerr << "Failure: The value read's data length was not equal to that of the value set." << 
std::endl;


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