mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed memory leak in SharedFilesDialog where destructor was not freeing the tree models
This commit is contained in:
parent
9ae790e80b
commit
98edbc55d2
@ -146,8 +146,14 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SharedFilesDialog::~SharedFilesDialog()
|
||||||
|
{
|
||||||
|
delete tree_model;
|
||||||
|
delete flat_model;
|
||||||
|
delete tree_proxyModel;
|
||||||
|
}
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareDirModel *_flat_model,QWidget *parent)
|
SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent)
|
||||||
: RsAutoUpdatePage(1000,parent), model(NULL)
|
: RsAutoUpdatePage(1000,parent), model(NULL)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
@ -158,13 +164,12 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
|
|||||||
connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool)));
|
connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool)));
|
||||||
|
|
||||||
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
|
connect(ui.viewType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCurrentViewModel(int)));
|
||||||
|
|
||||||
connect(ui.dirTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( spawnCustomPopupMenu( QPoint ) ) );
|
connect(ui.dirTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT( spawnCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
connect(ui.indicatorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(indicatorChanged(int)));
|
connect(ui.indicatorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(indicatorChanged(int)));
|
||||||
|
|
||||||
tree_model = _tree_model ;
|
tree_model = new TreeStyle_RDM(remote_mode);
|
||||||
flat_model = _flat_model ;
|
flat_model = new FlatStyle_RDM(remote_mode);
|
||||||
|
|
||||||
connect(flat_model, SIGNAL(layoutChanged()), this, SLOT(updateDirTreeView()) );
|
connect(flat_model, SIGNAL(layoutChanged()), this, SLOT(updateDirTreeView()) );
|
||||||
|
|
||||||
// For filtering items we use a trick: the underlying model will use this FilterRole role to highlight selected items
|
// For filtering items we use a trick: the underlying model will use this FilterRole role to highlight selected items
|
||||||
@ -241,7 +246,7 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
|
|||||||
}
|
}
|
||||||
|
|
||||||
LocalSharedFilesDialog::LocalSharedFilesDialog(QWidget *parent)
|
LocalSharedFilesDialog::LocalSharedFilesDialog(QWidget *parent)
|
||||||
: SharedFilesDialog(new TreeStyle_RDM(false),new FlatStyle_RDM(false),parent)
|
: SharedFilesDialog(false,parent)
|
||||||
{
|
{
|
||||||
// Hide columns after loading the settings
|
// Hide columns after loading the settings
|
||||||
ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, false) ;
|
ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, false) ;
|
||||||
@ -267,7 +272,7 @@ LocalSharedFilesDialog::LocalSharedFilesDialog(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
|
RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
|
||||||
: SharedFilesDialog(new TreeStyle_RDM(true),new FlatStyle_RDM(true),parent)
|
: SharedFilesDialog(true,parent)
|
||||||
{
|
{
|
||||||
ui.dirTreeView->setColumnHidden(COLUMN_FRIEND_ACCESS, false) ;
|
ui.dirTreeView->setColumnHidden(COLUMN_FRIEND_ACCESS, false) ;
|
||||||
ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, true) ;
|
ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, true) ;
|
||||||
|
@ -38,10 +38,10 @@ class SharedFilesDialog : public RsAutoUpdatePage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
SharedFilesDialog(RetroshareDirModel *tree_model,RetroshareDirModel *flat_model,QWidget *parent = 0);
|
SharedFilesDialog(bool remote_mode,QWidget *parent = 0);
|
||||||
|
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~SharedFilesDialog() {}
|
~SharedFilesDialog() ;
|
||||||
|
|
||||||
virtual void hideEvent(QHideEvent *) ;
|
virtual void hideEvent(QHideEvent *) ;
|
||||||
virtual void showEvent(QShowEvent *) ;
|
virtual void showEvent(QShowEvent *) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user