Rebind ticket editor before releasing preview providers (by Codex)
This commit is contained in:
1 parent
0edf208405
commit
5a9121b872
4 files changed
+30
-1
No files matched your search
@@ -7,7 +7,10 @@ void App::engine_finance_submit(const Json &command) {
|
||||
}, true);
|
||||
}
|
||||
void App::engine_ticket_bind() {
|
||||
if (ticket_) return;
|
||||
if (ticket_ && ticket_engine_bound_) return;
|
||||
// A preview editor captures its DataSource by reference. Destroy it while
|
||||
// that provider still exists, before the career handoff releases the source.
|
||||
ticket_.reset();
|
||||
ticket_ = std::make_unique<TicketPopover>(*context_, *doc_, [this] {
|
||||
Json state;
|
||||
if (engine_fresh_ && !engine_busy_) {
|
||||
@@ -22,6 +25,7 @@ void App::engine_ticket_bind() {
|
||||
return ActionResult{true, input_revision(), {}};
|
||||
} catch (const std::exception &e) { return ActionResult{false, input_revision(), e.what()}; }
|
||||
}, [this] { focus_after_render_ = "account-ticket"; dirty_ = true; });
|
||||
ticket_engine_bound_ = true;
|
||||
}
|
||||
bool App::engine_bank_action(const std::string &action, Rml::Element *target) {
|
||||
if (!engine_fresh_ || engine_busy_) return true;
|
||||
|
||||
@@ -379,6 +379,7 @@ class App final : public Rml::EventListener {
|
||||
std::shared_ptr<const Catalog> world_;
|
||||
std::unique_ptr<DemoSource> source_;
|
||||
std::unique_ptr<TicketPopover> ticket_;
|
||||
bool ticket_engine_bound_ = false;
|
||||
std::unique_ptr<SelectMenu> select_menu_;
|
||||
bool select_text_input_owned_ = false;
|
||||
struct SelectCapture final : Rml::EventListener {
|
||||
@@ -659,6 +660,7 @@ class App final : public Rml::EventListener {
|
||||
reset_settings();
|
||||
reset_files();
|
||||
ticket_.reset();
|
||||
ticket_engine_bound_ = false;
|
||||
bind_world(next);
|
||||
world_ = std::move(next);
|
||||
source_ = std::move(demo);
|
||||
|
||||
@@ -369,6 +369,7 @@ void App::files_loaded_success() {
|
||||
almanac_match_.clear();
|
||||
almanac_tab_ = "lineups";
|
||||
widget_data_ = Json();
|
||||
ticket_engine_bound_ = false;
|
||||
ticket_ = std::make_unique<TicketPopover>(*context_, *doc_, *source_, [this] {
|
||||
focus_ticket_ = true;
|
||||
refresh();
|
||||
|
||||
Reference in new issue
Block a user