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

This commit is contained in:
giantpune 2011-05-16 07:46:42 +00:00
parent 32cf8113e4
commit 15d6ba4344
2 changed files with 536 additions and 533 deletions

View File

@ -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();