Changeset 200 for trunk/src


Ignore:
Timestamp:
05/04/2009 08:56:21 AM (3 years ago)
Author:
guyru
Message:

Make use of boost::scoped_pointer in MainFrame?

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MainFrame.cpp

    r199 r200  
    9494        std::string config_file_str; 
    9595        config_file_str = config_file.utf8_str(); 
    96         m_config = new configuration::Configuration(config_file_str); 
    97         m_stats = new statistics::Statistics(m_config); 
     96        m_config.reset(new configuration::Configuration(config_file_str)); 
     97        m_stats.reset(new statistics::Statistics(m_config.get())); 
    9898 
    9999        m_evt_handler = new MainFrameEvtHandler(this); 
     
    521521void MainFrame::OnShowHighscore(wxCommandEvent& event) 
    522522{ 
    523         highscores_dialog::HighscoresDialog *dialog = new highscores_dialog::HighscoresDialog(this,m_config); 
     523        highscores_dialog::HighscoresDialog *dialog = new highscores_dialog::HighscoresDialog(this, m_config.get()); 
    524524 
    525525        dialog->ShowModal(); 
     
    530530void MainFrame::OnStatistics(wxCommandEvent &event) 
    531531{ 
    532         statistics_dialog::StatisticsDialog *dialog = new statistics_dialog::StatisticsDialog(this, m_stats); 
     532        statistics_dialog::StatisticsDialog *dialog = new statistics_dialog::StatisticsDialog(this, m_stats.get()); 
    533533        dialog->ShowModal(); 
    534534        delete dialog; 
     
    542542void MainFrame::OnSettings( wxCommandEvent& event) 
    543543{ 
    544         settings_dialog::SettingsDialog* settings_dialog = new settings_dialog::SettingsDialog(this, m_config); 
     544        settings_dialog::SettingsDialog* settings_dialog = new settings_dialog::SettingsDialog(this, m_config.get()); 
    545545 
    546546        if (settings_dialog->ShowModal()!=wxID_OK) { 
     
    10321032 
    10331033        //now show the high score table 
    1034         highscores_dialog::HighscoresDialog *dialog = new highscores_dialog::HighscoresDialog(this,m_config,rank); 
     1034        highscores_dialog::HighscoresDialog *dialog = new highscores_dialog::HighscoresDialog(this, m_config.get(),rank); 
    10351035 
    10361036        dialog->ShowModal(); 
     
    13551355MainFrame::~MainFrame() { 
    13561356        // free pointers 
    1357         delete m_stats; 
    1358         delete m_config; 
    13591357        delete m_evt_handler; 
    13601358 
  • trunk/src/MainFrame.h

    r199 r200  
    2727#ifndef OPENYAHTZEE_MAIN_FRAME_INC 
    2828#define OPENYAHTZEE_MAIN_FRAME_INC 
     29#include <memory> 
     30#include <boost/scoped_ptr.hpp> 
    2931#include "ScoreDice.h" 
    3032#include "configuration.h" 
     
    8284        ScoreDice m_score_dice; 
    8385 
    84         configuration::Configuration *m_config; 
    85         statistics::Statistics *m_stats; 
     86        boost::scoped_ptr<configuration::Configuration> m_config; 
     87        boost::scoped_ptr<statistics::Statistics> m_stats; 
    8688 
    8789private: 
Note: See TracChangeset for help on using the changeset viewer.