(qt) plug a handful of minor memory leaks

This commit is contained in:
Jordan Lee 2013-02-03 12:31:44 +00:00
parent 1c90e929d1
commit 5dab28ee9c
2 changed files with 12 additions and 12 deletions

View File

@ -226,14 +226,14 @@ FilterBarComboBox *
FilterBar :: createActivityCombo ()
{
FilterBarComboBox * c = new FilterBarComboBox (this);
FilterBarComboBoxDelegate * delegate = new FilterBarComboBoxDelegate (0, c);
FilterBarComboBoxDelegate * delegate = new FilterBarComboBoxDelegate (this, c);
c->setItemDelegate (delegate);
QPixmap blankPixmap (c->iconSize ());
blankPixmap.fill (Qt::transparent);
QIcon blankIcon (blankPixmap);
QStandardItemModel * model = new QStandardItemModel;
QStandardItemModel * model = new QStandardItemModel (this);
QStandardItem * row = new QStandardItem (tr ("All"));
row->setData (FilterMode::SHOW_ALL, ActivityRole);
@ -392,7 +392,7 @@ FilterBarComboBox *
FilterBar :: createTrackerCombo (QStandardItemModel * model)
{
FilterBarComboBox * c = new FilterBarComboBox (this);
FilterBarComboBoxDelegate * delegate = new FilterBarComboBoxDelegate (0, c);
FilterBarComboBoxDelegate * delegate = new FilterBarComboBoxDelegate (this, c);
c->setItemDelegate (delegate);
QStandardItem * row = new QStandardItem (tr ("All"));
@ -426,7 +426,7 @@ FilterBar :: FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& fil
QHBoxLayout * h = new QHBoxLayout (this);
const int hmargin = qMax (int (HIG::PAD), style ()->pixelMetric (QStyle::PM_LayoutHorizontalSpacing));
myCountLabel = new QLabel;
myCountLabel = new QLabel (this);
h->setSpacing (0);
h->setContentsMargins (2, 2, 2, 2);
h->addWidget (myCountLabel);
@ -436,7 +436,7 @@ FilterBar :: FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& fil
h->addWidget (myActivityCombo, 1);
h->addSpacing (hmargin);
myTrackerModel = new QStandardItemModel;
myTrackerModel = new QStandardItemModel (this);
myTrackerCombo = createTrackerCombo (myTrackerModel);
h->addWidget (myTrackerCombo, 1);
h->addSpacing (hmargin*2);
@ -445,7 +445,7 @@ FilterBar :: FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& fil
h->addWidget (myLineEdit);
connect (myLineEdit, SIGNAL (textChanged (QString)), this, SLOT (onTextChanged (QString)));
QPushButton * p = new QPushButton;
QPushButton * p = new QPushButton (this);
QIcon icon = QIcon::fromTheme ("edit-clear", style ()->standardIcon (QStyle::SP_DialogCloseButton));
int iconSize = style ()->pixelMetric (QStyle::PM_SmallIconSize);
p->setIconSize (QSize (iconSize, iconSize));

View File

@ -232,7 +232,7 @@ TrMainWindow :: TrMainWindow (Session& session, Prefs& prefs, TorrentModel& mode
myAltSpeedAction->setIcon (myPrefs.get<bool> (Prefs::ALT_SPEED_LIMIT_ENABLED) ? mySpeedModeOnIcon : mySpeedModeOffIcon);
connect (myAltSpeedAction, SIGNAL (triggered ()), this, SLOT (toggleSpeedMode ()));
QMenu * menu = new QMenu ();
QMenu * menu = new QMenu (this);
menu->addAction (ui.action_OpenFile);
menu->addAction (ui.action_AddURL);
menu->addSeparator ();
@ -429,7 +429,7 @@ TrMainWindow :: createStatusBar ()
a->addAction (ui.action_TotalTransfer);
a->addAction (ui.action_SessionRatio);
a->addAction (ui.action_SessionTransfer);
m = new QMenu ();
m = new QMenu (this);
m->addAction (ui.action_TotalRatio);
m->addAction (ui.action_TotalTransfer);
m->addAction (ui.action_SessionRatio);
@ -461,7 +461,7 @@ TrMainWindow :: createOptionsMenu ()
QList<double> stockRatios;
stockRatios << 0.25 << 0.50 << 0.75 << 1 << 1.5 << 2 << 3;
menu = new QMenu;
menu = new QMenu (this);
sub = menu->addMenu (tr ("Limit Download Speed"));
int currentVal = myPrefs.get<int> (Prefs::DSPEED);
@ -1457,7 +1457,7 @@ TrMainWindow :: contextMenuEvent (QContextMenuEvent * event)
menu->addAction (ui.action_Properties);
menu->addAction (ui.action_OpenFolder);
QAction * sep = new QAction (this);
QAction * sep = new QAction (menu);
sep->setSeparator (true);
menu->addAction (sep);
menu->addAction (ui.action_Start);
@ -1470,14 +1470,14 @@ TrMainWindow :: contextMenuEvent (QContextMenuEvent * event)
queueMenu->addAction (ui.action_QueueMoveBottom);
menu->addAction (ui.action_Pause);
sep = new QAction (this);
sep = new QAction (menu);
sep->setSeparator (true);
menu->addAction (sep);
menu->addAction (ui.action_Verify);
menu->addAction (ui.action_SetLocation);
menu->addAction (ui.action_CopyMagnetToClipboard);
sep = new QAction (this);
sep = new QAction (menu);
sep->setSeparator (true);
menu->addAction (sep);
menu->addAction (ui.action_Remove);