Resource Downloading - #1298
Conversation
|
This PR is now ready to be reviewed. Let me know if you want the PR to be split up. |
| if (current_state() != ProgramState::RUNNING){ | ||
| return; | ||
| } | ||
| m_scope.store(&scope, std::memory_order_release); |
There was a problem hiding this comment.
I should really redesign this m_scope mechanism here. I hate. But that's for a future cleanup.
| } | ||
|
|
||
| void SingleSwitchProgramWidget2::download_added(std::shared_ptr<ResourceDownload> download_ptr){ | ||
| QMetaObject::invokeMethod(this, [this, download_ptr]{ |
There was a problem hiding this comment.
I wonder if this works:
QMetaObject::invokeMethod(this, [this, download_ptr = std::move(download_ptr)]{
This moves it into the lambda instead of copying.
Same with the other places.
| m_actions_bar = new RunnablePanelActionBar(*this, m_session.current_state()); | ||
| layout->addWidget(m_actions_bar); | ||
|
|
||
| m_downloads_table = new ProgramResourceDownloadTableWidget(*this); |
There was a problem hiding this comment.
I wonder if this should be done lazily (on first use). The vast majority of programs won't need this. So unconditionally instantiating its sounds wasteful especially since the widget is non-trivial.
Don't need to do anything about it in this PR since it's big enough. Maybe a future cleanup.
|
|
||
| void ProgramMissingResourceTracker::add_resource(const std::shared_ptr<ResourceDownload>& resource){ | ||
| m_missing_resources.insert(resource); | ||
| resource->add_listener(*this); |
There was a problem hiding this comment.
If add_listener() throw here, you'll be left in a bad state which I think will hang.
I suggest wrapping it in an exception and if it throws, remove the resource (undo the 1st line) and rethrow exception.
* squash changes * update StaticRegistrationQt * minor change
No description provided.