Test case for "dopuble free or corruption" issue



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

Attached to this email is a small file that I think highlights that
adding an option group to a context has "issues".  With
SHOW_DATA_CORRUPTION_ISSUE set to 0 the program runs as expected, but
set to 1 (so thja the options.add_entry ( entry , version ) ; is
executed, then the result is:

*** glibc detected *** double free or corruption (fasttop): 0x0804b188
***
Aborted

I am using Ubuntu 6.06 LTS Dapper Drake so GTKmm is version:

ii  libgtkmm-2.4-1c2a             2.8.8-0ubuntu1                C++
wrappers for GTK+ 2.4 (shared libraries)

(clearly this is an old GTKmm so the bug may not be a bug any more as
far as GTKmm is concerned.)

-- 
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>

#define SHOW_DATA_CORRUPTION_ISSUE 0

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" ) ;
#if SHOW_DATA_CORRUPTION_ISSUE
  options.add_entry ( entry , version ) ;
#endif
  Glib::OptionContext context ( "-- A message." ) ;
  context.add_group ( options ) ;
  context.set_main_group ( options ) ;
  try { Gtk::Main application ( ac , av , context ) ; }
  catch ( const Glib::OptionError & e ) { std::cout << e.what ( ) << std::endl ; return 1 ; }
  if ( version ) { std::cout << name << " v" << "0.0.1" << std::endl ; return 0 ; }
  return 0 ;
}

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]