This isn't fully working, as skipping the .then() callbacks skips over
important cleanup and leads to failure further down the line.
TransferStatusPtr status = (*it)->get_status();
m_transfers.erase(it);
- status->status = TransferStatus::COMPLETED;
for(auto& callback : status->callbacks)
{
callback();
public:
TransferId id;
- Status status;
+ std::vector<std::function<void ()> > callbacks;
+
int dltotal;
int dlnow;
int ultotal;
int ulnow;
- std::vector<std::function<void ()> > callbacks;
TransferStatus(TransferId id_) :
id(id_),
- status(RUNNING),
+ callbacks(),
dltotal(0),
dlnow(0),
ultotal(0),
- ulnow(0),
- callbacks()
+ ulnow(0)
{}
void then(const std::function<void ()>& callback)
#include "supertux/globals.hpp"
#include "supertux/menu/menu_storage.hpp"
#include "supertux/timer.hpp"
+#include "util/gettext.hpp"
#include "util/log.hpp"
#include "video/drawing_context.hpp"
{
if (m_dialog)
{
- m_dialog->update();
+ try
+ {
+ m_dialog->update();
+ }
+ catch(const std::exception& err)
+ {
+ m_dialog = std::unique_ptr<Dialog>(new Dialog);
+ m_dialog->set_text(_("Error:\n") + err.what());
+ m_dialog->add_button(_("Ok"));
+ }
+
m_dialog->draw(context);
}
else if (current_menu())