[glom/gtktoolpallete] Print Layouts: Avoid crash when closing the editing window.



commit 9a219efc2a222b616f407fdb67da1f8c94ab758c
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Dec 28 23:38:42 2009 +0100

    Print Layouts: Avoid crash when closing the editing window.
    
    * glom/print_layout/canvas_print_layout.cc: get_print_layout():
    Avoid a crash when m_page_setup is null, though we need to find out why it
    is null.

 ChangeLog                                |    8 ++++++++
 glom/print_layout/canvas_print_layout.cc |    8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 789b7fb..01d2587 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-12-28  Murray Cumming  <murrayc murrayc com>
 
+  Print Layouts: Avoid crash when closing the editing window.
+  
+	* glom/print_layout/canvas_print_layout.cc: get_print_layout():
+	Avoid a crash when m_page_setup is null, though we need to find out why it 
+	is null.
+
+2009-12-28  Murray Cumming  <murrayc murrayc com>
+
 	Fix the build.
 
 	* glom/mode_design/print_layouts/print_layout_toolbar.cc:
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index ceeca6c..10f1c47 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -114,7 +114,8 @@ sharedptr<PrintLayout> Canvas_PrintLayout::get_print_layout()
 
   //Page Setup:
   Glib::KeyFile key_file;
-  m_page_setup->save_to_key_file(key_file);
+  if(m_page_setup)
+    m_page_setup->save_to_key_file(key_file);
  
   Glib::ustring data;
   #ifdef GLIBMM_EXCEPTIONS_ENABLED
@@ -509,8 +510,11 @@ void Canvas_PrintLayout::set_page_setup(const Glib::RefPtr<Gtk::PageSetup>& page
 {
   m_page_setup = page_setup;
   if(!m_page_setup)
+  {
+    std::cerr << "Canvas_PrintLayout::set_page_setup(): page_setup is null." << std::endl;
     return;
-
+  }
+  
   //Change the scroll extents to match the page size:
   Gtk::PaperSize paper_size = m_page_setup->get_paper_size();
   Goocanvas::Bounds bounds;



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