mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Clean up pointer use:
* Use unique_ptr for Actions instead of manual memory management * Use unique_ptr in KeywordDatabase * Use unique_ptr instead of shared_ptr for file formats * Don't pass shared_ptr to Reader/Writer, use references instead Also * Switch to C++17 so we can use map::try_emplace
This commit is contained in:
@@ -82,15 +82,14 @@ bool DownloadableInstallerList::download() {
|
||||
wxThread::ExitCode DownloadableInstallerList::Thread::Entry() {
|
||||
// open url
|
||||
wxURL url(settings.installer_list_url);
|
||||
wxInputStream* isP = url.GetInputStream();
|
||||
if (!isP) {
|
||||
unique_ptr<wxInputStream> stream(url.GetInputStream());
|
||||
if (!stream) {
|
||||
wxMutexLocker l(downloadable_installers.lock);
|
||||
downloadable_installers.status = DONE;
|
||||
return 0;
|
||||
}
|
||||
InputStreamP is(isP);
|
||||
// Read installer list
|
||||
Reader reader(is, nullptr, _("installers"), true);
|
||||
Reader reader(*stream, nullptr, _("installers"), true);
|
||||
vector<DownloadableInstallerP> installers;
|
||||
reader.handle(_("installers"),installers);
|
||||
// done
|
||||
@@ -344,7 +343,7 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
|
||||
}
|
||||
// download installer
|
||||
wxURL url(ip->installer->installer_url);
|
||||
wxInputStream* is = url.GetInputStream();
|
||||
unique_ptr<wxInputStream> is(url.GetInputStream());
|
||||
if (!is) {
|
||||
throw Error(_ERROR_2_("can't download installer", ip->description->name, ip->installer->installer_url));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user