Test case for assertion issues and seg fault



On Wed, 2006-09-27 at 20:31 +0200, Murray Cumming wrote:
> If you attach an actual test case, I will investigate.

Attached an extended version of the previous test case that shows the
assertion failures (I am fairly sure caused by something stupid I am or
am not doing) and the segfault.  The assertion failures always happen
the seg faulting is controlled with the SHOW_SEGFAULT macro.

-- 
Russel.
====================================================
Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             russel russel org uk
#include <iostream>

#include <glibmm.h>
#include <gtkmm.h>
#include <libglademm.h>

#define SHOW_SEGFAULT 0

Gtk::Window * mainWindow  ;
Gtk::TreeView * mainWindow_familyList ;
Gtk::SpinButton * mainWindow_fontSize  ;
Gtk::TreeView * mainWindow_presentationList ;
Gtk::Entry * mainWindow_sampleText  ;

void initialize_mainWindow_fontSize ( ) { }

void initialize_mainWindow_sampleText ( ) { }

void showAbout ( ) { }

int main ( int ac , char * * av ) {
  Glib::ustring name ( "test" ) ;
  bool version ( FALSE ) ;
  Glib::OptionEntry entry ;
  entry.set_long_name ( "version" ) ;
  entry.set_description ( "Show version and exit." ) ;
  Glib::OptionGroup options ( name , "Test" ) ;
  options.add_entry ( entry , version ) ;
  Glib::OptionContext context ( "-- A message." ) ;
  context.add_group ( options ) ;
  context.set_main_group ( options ) ;
#if SHOW_SEGFAULT
  try { Gtk::Main application ( ac , av , context ) ; }
  catch ( const Glib::OptionError & e ) { std::cout << e.what ( ) << std::endl ; return 1 ; }
#else
  Gtk::Main application ( ac , av , context ) ;
#endif
  if ( version ) { std::cout << name << " v" << "0.0.1" << std::endl ; return 0 ; }
  Glib::RefPtr<Gnome::Glade::Xml> refXml ;
  try { refXml = Gnome::Glade::Xml::create ( "gfontbrowser.glade" ) ; }
  catch ( const Gnome::Glade::XmlError & e ) { std::cerr << e.what ( ) << std::endl ; exit ( 1 ) ; }
  refXml->get_widget ( "mainWindow" , mainWindow ) ;
  Glib::RefPtr<Gtk::MenuItem> quitMenuItem ( dynamic_cast<Gtk::MenuItem *> ( refXml->get_widget ( "mainWindow_quit" ) ) ) ;
  quitMenuItem->signal_activate ( ).connect ( sigc::ptr_fun ( &Gtk::Main::quit ) ) ;
  Glib::RefPtr<Gtk::MenuItem> aboutMenuItem ( dynamic_cast<Gtk::MenuItem *> ( refXml->get_widget ( "mainWindow_about" ) ) ) ;
  aboutMenuItem->signal_activate ( ).connect ( sigc::ptr_fun ( &showAbout ) ) ;
  refXml->get_widget ( "mainWindow_familyList" , mainWindow_familyList ) ;
  refXml->get_widget ( "mainWindow_presentationList" , mainWindow_presentationList ) ;
  refXml->get_widget ( "mainWindow_sampleText" , mainWindow_sampleText ) ;
  initialize_mainWindow_sampleText ( ) ;
  refXml->get_widget ( "mainWindow_fontSize" , mainWindow_fontSize ) ;
  initialize_mainWindow_fontSize ( ) ;
  Gtk::Main::run ( *mainWindow ) ;

  return 0 ;
}

Attachment: gfontbrowser.glade
Description: application/glade

Attachment: signature.asc
Description: This is a digitally signed message part



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