diff --git a/tests/app/src/main.cpp b/tests/app/src/main.cpp index d18d560f..5cdf45d9 100644 --- a/tests/app/src/main.cpp +++ b/tests/app/src/main.cpp @@ -73,7 +73,7 @@ class simple_widget : this->context.get().updater.get().stop(*this); }else{ this->context.get().updater.get().start( - utki::make_shared_from(*this).to_shared_ptr(), + utki::make_shared_from(*this), // 0 ); } @@ -521,8 +521,7 @@ class application : public ruisapp::application{ // cube click_proxy { - auto cube = c.get().try_get_widget_as("cube_widget"); - ASSERT(cube) + auto& cube = c.get().get_widget_as("cube_widget"); auto& cp = c.get().get_widget_as("cube_click_proxy"); auto& bg = c.get().get_widget_as("cube_bg_color"); @@ -532,11 +531,11 @@ class application : public ruisapp::application{ return true; }; cp.pressed_change_handler(cp); // set initial color - cp.click_handler = [cube](ruis::click_proxy&) -> bool { - if(cube->is_updating()){ - cube->context.get().updater.get().stop(*cube); + cp.click_handler = [cube = utki::make_shared_from(cube)](ruis::click_proxy&) -> bool { + if(cube.get().is_updating()){ + cube.get().context.get().updater.get().stop(cube.get()); }else{ - cube->context.get().updater.get().start(cube, 0); + cube.get().context.get().updater.get().start(cube, 0); } return true; }; diff --git a/tests/book/src/cube_page.cpp b/tests/book/src/cube_page.cpp index 3f201000..415614fe 100644 --- a/tests/book/src/cube_page.cpp +++ b/tests/book/src/cube_page.cpp @@ -102,8 +102,8 @@ class cube_widget : public ruis::widget, public ruis::updateable{ }; } -cube_page::cube_page(const utki::shared_ref& c) : - widget(c, tml::forest()), +cube_page::cube_page(utki::shared_ref c) : + widget(std::move(c), tml::forest()), page(this->context, tml::forest()), container(this->context, tml::read(R"qwertyuiop( layout{pile} @@ -142,7 +142,7 @@ cube_page::cube_page(const utki::shared_ref& c) : } void cube_page::on_show(){ - this->context.get().updater.get().start(this->cube, 0); + this->context.get().updater.get().start(utki::shared_ref(this->cube), 0); } void cube_page::on_hide()noexcept{ diff --git a/tests/book/src/cube_page.hpp b/tests/book/src/cube_page.hpp index 5bdaaa51..06695753 100644 --- a/tests/book/src/cube_page.hpp +++ b/tests/book/src/cube_page.hpp @@ -9,7 +9,7 @@ class cube_page : { std::shared_ptr cube; public: - cube_page(const utki::shared_ref& c); + cube_page(utki::shared_ref c); cube_page(const cube_page&) = delete; cube_page& operator=(const cube_page&) = delete;