Use a scoped_ptr

This commit is contained in:
John Maguire 2011-11-03 15:07:36 +01:00
parent 0133bccf81
commit a9d6535bcc
2 changed files with 4 additions and 4 deletions

View File

@ -46,7 +46,6 @@ DigitallyImportedServiceBase::DigitallyImportedServiceBase(
premium_audio_type_(2),
task_id_(-1),
root_(NULL),
context_menu_(NULL),
context_item_(NULL),
api_client_(NULL)
{
@ -84,7 +83,6 @@ void DigitallyImportedServiceBase::Init(
}
DigitallyImportedServiceBase::~DigitallyImportedServiceBase() {
delete context_menu_;
}
QStandardItem* DigitallyImportedServiceBase::CreateRootItem() {
@ -208,7 +206,7 @@ void DigitallyImportedServiceBase::ReloadSettings() {
void DigitallyImportedServiceBase::ShowContextMenu(
const QModelIndex& index, const QPoint& global_pos) {
if (!context_menu_) {
context_menu_ = new QMenu;
context_menu_.reset(new QMenu);
context_menu_->addActions(GetPlaylistActions());
context_menu_->addAction(IconLoader::Load("download"),
tr("Open %1 in browser").arg(homepage_name_),

View File

@ -20,6 +20,8 @@
#include "internetservice.h"
#include <boost/scoped_ptr.hpp>
class DigitallyImportedClient;
class DigitallyImportedUrlHandler;
@ -124,7 +126,7 @@ private:
QStandardItem* root_;
QMenu* context_menu_;
boost::scoped_ptr<QMenu> context_menu_;
QStandardItem* context_item_;
QList<Stream> saved_streams_;