* ohneschwanzenegger: fix possible crash, use const reference when installing shared contents

git-svn-id: http://wiiqt.googlecode.com/svn/trunk@88 389f4c8b-5dfe-645f-db0e-df882bc27289
This commit is contained in:
giantpune 2011-05-16 07:46:42 +00:00
parent 8a683c7078
commit 04094e8e54
2 changed files with 536 additions and 533 deletions

View File

@ -49,7 +49,7 @@ MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::M
connect( &nus, SIGNAL( SendText( QString ) ), ui->statusBar, SLOT( showMessage( QString ) ) ); connect( &nus, SIGNAL( SendText( QString ) ), ui->statusBar, SLOT( showMessage( QString ) ) );
connect( &nus, SIGNAL( SendError( const QString &, NusJob ) ), this, SLOT( GetError( const QString &, NusJob ) ) ); connect( &nus, SIGNAL( SendError( const QString &, NusJob ) ), this, SLOT( GetError( const QString &, NusJob ) ) );
connect( &nus, SIGNAL( SendDone() ), this, SLOT( NusIsDone() ) ); connect( &nus, SIGNAL( SendDone() ), this, SLOT( NusIsDone() ) );
connect( &nus, SIGNAL( SendData( NusJob ) ), this, SLOT( ReceiveTitleFromNus( NusJob) ) ); connect( &nus, SIGNAL( SendData( NusJob ) ), this, SLOT( ReceiveTitleFromNus( NusJob ) ) );
//connect to the nand.bin to get text and crap from it //connect to the nand.bin to get text and crap from it
connect( &nand, SIGNAL( SendError( const QString & ) ), this, SLOT( GetError( const QString & ) ) ); connect( &nand, SIGNAL( SendError( const QString & ) ), this, SLOT( GetError( const QString & ) ) );
@ -174,12 +174,12 @@ void MainWindow::NusIsDone()
{ {
nandDirty = true; nandDirty = true;
UpdateTree(); UpdateTree();
ShowMessage( tr( "Saved setting.txt" ) );
} }
} }
} }
} }
//nand.Delete( "/title/00000001/00000002/content/title.tmd" );
if( nandDirty ) if( nandDirty )
{ {
if( !FlushNand() ) if( !FlushNand() )
@ -547,7 +547,10 @@ bool MainWindow::UpdateTree()
{ {
//set up the tree so we know what all is in the nand without asking for it every time //set up the tree so we know what all is in the nand without asking for it every time
if( root ) if( root )
{
delete root; delete root;
root = NULL;
}
QTreeWidgetItem *r = nand.GetTree(); QTreeWidgetItem *r = nand.GetTree();
if( r->childCount() != 1 || r->child( 0 )->text( 0 ) != "/" ) if( r->childCount() != 1 || r->child( 0 )->text( 0 ) != "/" )
{ {
@ -575,7 +578,7 @@ quint16 MainWindow::CreateIfNeeded( const QString &path, quint32 uid, quint16 gi
return item->text( 1 ).toInt(); return item->text( 1 ).toInt();
} }
bool MainWindow::InstallSharedContent( const QByteArray stuff, const QByteArray hash ) bool MainWindow::InstallSharedContent( const QByteArray &stuff, const QByteArray &hash )
{ {
//qDebug() << "MainWindow::InstallSharedContent"; //qDebug() << "MainWindow::InstallSharedContent";
QByteArray h; QByteArray h;

View File

@ -44,7 +44,7 @@ private:
bool InstallNUSItem( NusJob job ); bool InstallNUSItem( NusJob job );
quint16 CreateIfNeeded( const QString &path, quint32 uid, quint16 gid, quint8 attr, quint8 user_perm, quint8 group_perm, quint8 other_perm ); quint16 CreateIfNeeded( const QString &path, quint32 uid, quint16 gid, quint8 attr, quint8 user_perm, quint8 group_perm, quint8 other_perm );
bool InstallSharedContent( const QByteArray stuff, const QByteArray hash = QByteArray() ); bool InstallSharedContent( const QByteArray &stuff, const QByteArray &hash = QByteArray() );
void SaveSettings(); void SaveSettings();
void LoadSettings(); void LoadSettings();