renderer/canvas: Check refresh before draw

If target() is called again after update() is called and the size of the buffer changes, a crash may occur.
Therefore, check the refresh variable and perform drawing after update().
This commit is contained in:
JunsuChoi 2024-06-21 17:45:48 +09:00 committed by Hermet Park
parent b71d9d563a
commit 60212747b5

View file

@ -114,6 +114,7 @@ struct Canvas::Impl
Result draw() Result draw()
{ {
if (refresh) update(nullptr, false);
if (status == Status::Drawing || paints.empty() || !renderer->preRender()) return Result::InsufficientCondition; if (status == Status::Drawing || paints.empty() || !renderer->preRender()) return Result::InsufficientCondition;
bool rendered = false; bool rendered = false;