Ensure no pending operations before creating partition table (#583896)

This fixes a situation where GParted would crash if a user queued
up some operations, created a new partition table, and then
applied the operations.
This commit is contained in:
Curtis Gedak 2009-10-25 14:33:36 -06:00
parent 0723c82f30
commit 83381f85f1
1 changed files with 28 additions and 0 deletions

View File

@ -1880,6 +1880,34 @@ void Win_GParted::activate_mount_partition( unsigned int index )
void Win_GParted::activate_disklabel()
{
//If there are pending operations then warn the user that these
// operations must either be applied or cleared before creating
// a new partition table.
if ( operations .size() )
{
Glib::ustring tmp_msg =
String::ucompose( ngettext( "%1 operation is currently pending."
, "%1 operations are currently pending."
, operations .size()
)
, operations .size()
) ;
Gtk::MessageDialog dialog( *this
, tmp_msg
, false
, Gtk::MESSAGE_INFO
, Gtk::BUTTONS_OK
, true
) ;
tmp_msg = _( "A new partition table cannot be created when there are pending operations." ) ;
tmp_msg += "\n" ;
tmp_msg += _( "Use the Edit menu to either clear or apply all operations before creating a new partition table." ) ;
dialog .set_secondary_text( tmp_msg ) ;
dialog .run() ;
return ;
}
//Display dialog for creating a new partition table.
Dialog_Disklabel dialog( devices[ current_device ] .get_path(), gparted_core .get_disklabeltypes() ) ;
dialog .set_transient_for( *this );