selecting 'extended partition' twice caused a segfault. i cannot believe i

* src/Dialog_Partition_New.cc: selecting 'extended partition' twice caused a segfault. i cannot believe i didn't detect this bug earlier :| Fixed.
  also made it possible to create an unformatted partition.
* src/GParted_Core.cc: backend support for creating partition without filesystem (unformatted).
This commit is contained in:
Bart Hakvoort 2004-11-28 14:30:15 +00:00
parent 3ba1e996f4
commit 7235baf156
3 changed files with 15 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2004-11-28 Bart Hakvoort <gparted@users.sf.net>
* src/Dialog_Partition_New.cc: selecting 'extended partition' twice caused a segfault. i cannot believe i didn't detect this bug earlier :| Fixed.
also made it possible to create an unformatted partition.
* src/GParted_Core.cc: backend support for creating partition without filesystem (unformatted).
2004-11-28 Bart Hakvoort <gparted@users.sf.net>
* src/Dialog_Disklabel.cc,

View File

@ -42,7 +42,8 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
this ->new_count = new_count;
this ->selected_partition = partition;
this ->FILESYSTEMS = FILESYSTEMS ;
this ->FILESYSTEMS .erase( this ->FILESYSTEMS .end( ) ) ;//remove dummy "unknown"
this ->FILESYSTEMS .back( ) .filesystem = _("Unformatted") ;
this ->FILESYSTEMS .back( ) .create = true ;
FS fs ; fs.filesystem = "extended" ;
this ->FILESYSTEMS .push_back( fs ) ;
@ -167,13 +168,13 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
//optionmenu_type
if ( type )
{
if ( optionmenu_type .get_history( ) == GParted::EXTENDED )
if ( optionmenu_type .get_history( ) == GParted::EXTENDED && menu_filesystem .items( ) .size( ) < FILESYSTEMS .size( ) )
{
menu_filesystem .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( "extended" ) ) ;
optionmenu_filesystem .set_history( menu_filesystem .items( ) .size( ) -1 ) ;
optionmenu_filesystem .set_sensitive( false ) ;
}
else if ( menu_filesystem .items( ) .size( ) == FILESYSTEMS .size( ) )
else if ( optionmenu_type .get_history( ) != GParted::EXTENDED && menu_filesystem .items( ) .size( ) == FILESYSTEMS .size( ) )
{
menu_filesystem .items( ) .remove( menu_filesystem .items( ) .back( ) ) ;
optionmenu_filesystem .set_sensitive( true ) ;
@ -185,8 +186,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
if ( ! type )
{
//needed vor upper limit check (see also Dialog_Base_Partition::on_signal_resize )
//BART: i don't understand previous sentence, but i think this one's needed for correct color..
selected_partition .filesystem = FILESYSTEMS[ optionmenu_filesystem .get_history() ] .filesystem ;
selected_partition .filesystem = FILESYSTEMS[ optionmenu_filesystem .get_history( ) ] .filesystem ;
//set new spinbutton ranges
long MIN, MAX;

View File

@ -297,6 +297,10 @@ bool GParted_Core::Create( const Glib::ustring & device_path, Partition & new_pa
{
set_proper_filesystem( new_partition .filesystem ) ;
//most likely this means the user created an unformatted partition, however in theory, it could also screw some errorhandling.
if ( ! p_filesystem )
return true ;
return p_filesystem ->Create( device_path, new_partition ) ;
}