Commit 84c9b5f1 authored by Murray Cumming's avatar Murray Cumming

Replace all (deprecated) auto_ptr with unique_ptr.

parent f1063aa1
......@@ -90,7 +90,7 @@ private:
RegexxerOptions();
public:
static std::auto_ptr<RegexxerOptions> create();
static std::unique_ptr<RegexxerOptions> create();
~RegexxerOptions();
Glib::OptionContext& context() { return context_; }
......@@ -125,9 +125,9 @@ RegexxerOptions::~RegexxerOptions()
{}
// static
std::auto_ptr<RegexxerOptions> RegexxerOptions::create()
std::unique_ptr<RegexxerOptions> RegexxerOptions::create()
{
std::auto_ptr<RegexxerOptions> options (new RegexxerOptions());
std::unique_ptr<RegexxerOptions> options (new RegexxerOptions());
Glib::OptionGroup& group = options->group_;
Regexxer::InitState& init = options->init_state_;
......@@ -201,7 +201,7 @@ int main(int argc, char** argv)
{
Util::initialize_gettext(PACKAGE_TARNAME, REGEXXER_LOCALEDIR);
std::auto_ptr<RegexxerOptions> options = RegexxerOptions::create();
std::unique_ptr<RegexxerOptions> options = RegexxerOptions::create();
options->context().parse(argc, argv);
Glib::RefPtr<Gtk::Application> app =
Gtk::Application::create(argc, argv, Regexxer::conf_schema);
......
......@@ -572,13 +572,8 @@ void MainWindow::on_hide()
// necessary since they'd be deleted in the destructor anyway. But if we
// have to do a lot of cleanup the dialogs would stay open for that time,
// which doesn't look neat.
{
// Play safe and transfer ownership, and let the dtor do the delete.
const std::auto_ptr<Gtk::Dialog> temp (about_dialog_);
}
{
const std::auto_ptr<PrefDialog> temp (pref_dialog_);
}
about_dialog_.reset();
pref_dialog_.reset();
}
void MainWindow::on_style_updated()
......@@ -1173,7 +1168,7 @@ void MainWindow::on_about()
}
else
{
std::auto_ptr<Gtk::AboutDialog> dialog (new Gtk::AboutDialog());
std::unique_ptr<Gtk::AboutDialog> dialog (new Gtk::AboutDialog());
std::vector<Glib::ustring> authors;
for (int i = 0; program_authors[i]; i++)
authors.push_back(program_authors[i]);
......@@ -1194,14 +1189,13 @@ void MainWindow::on_about()
dialog->show();
dialog->signal_response().connect(sigc::mem_fun(*this, &MainWindow::on_about_dialog_response));
about_dialog_ = dialog;
about_dialog_ = std::move(dialog);
}
}
void MainWindow::on_about_dialog_response(int)
{
// Play safe and transfer ownership, and let the dtor do the delete.
const std::auto_ptr<Gtk::Dialog> temp (about_dialog_);
about_dialog_.reset();
}
void MainWindow::on_preferences()
......@@ -1212,20 +1206,19 @@ void MainWindow::on_preferences()
}
else
{
std::auto_ptr<PrefDialog> dialog (new PrefDialog(*window_));
std::unique_ptr<PrefDialog> dialog (new PrefDialog(*window_));
dialog->get_dialog()->signal_hide()
.connect(sigc::mem_fun(*this, &MainWindow::on_pref_dialog_hide));
dialog->get_dialog()->show();
pref_dialog_ = dialog;
pref_dialog_ = std::move(dialog);
}
}
void MainWindow::on_pref_dialog_hide()
{
// Play safe and transfer ownership, and let the dtor do the delete.
const std::auto_ptr<PrefDialog> temp (pref_dialog_);
pref_dialog_.reset();
}
void MainWindow::on_conf_value_changed(const Glib::ustring& key)
......
......@@ -102,7 +102,7 @@ private:
class BusyAction;
Glib::RefPtr<Gtk::Application> application_;
std::auto_ptr<Gtk::ApplicationWindow> window_;
std::unique_ptr<Gtk::ApplicationWindow> window_;
Controller controller_;
Gtk::Box* vbox_main_;
......@@ -147,8 +147,8 @@ private:
std::list<sigc::connection> buffer_connections_;
std::auto_ptr<Gtk::Dialog> about_dialog_;
std::auto_ptr<PrefDialog> pref_dialog_;
std::unique_ptr<Gtk::Dialog> about_dialog_;
std::unique_ptr<PrefDialog> pref_dialog_;
Glib::RefPtr<Gio::SimpleActionGroup> match_action_group_;
Glib::RefPtr<Gio::SimpleActionGroup> edit_action_group_;
......
......@@ -50,7 +50,7 @@ public:
Gtk::Dialog* get_dialog() { return dialog_.get(); }
private:
std::auto_ptr<Gtk::Dialog> dialog_;
std::unique_ptr<Gtk::Dialog> dialog_;
Gtk::FontButton* button_textview_font_;
Gtk::ColorButton* button_match_color_;
Gtk::ColorButton* button_current_color_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment