From d604400f7bda26911799bab40776f3cb24873b95 Mon Sep 17 00:00:00 2001 From: johannes Date: Sun, 22 Dec 2024 17:15:56 +0100 Subject: [PATCH] - avoid calling tbui functions without any running context --- code/addons/tbui/tbuicontext.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/addons/tbui/tbuicontext.cc b/code/addons/tbui/tbuicontext.cc index 4d2c98162..354cd1d0f 100644 --- a/code/addons/tbui/tbuicontext.cc +++ b/code/addons/tbui/tbuicontext.cc @@ -239,10 +239,11 @@ TBUIContext::Create() // Render some glyphs in one go now since we know we are going to use them. It would work fine // without this since glyphs are rendered when needed, but with some extra updating of the glyph bitmap. if (font) + { font->RenderGlyphs( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~•·åäöÅÄÖ" ); - + } tb::TBWidgetsAnimationManager::Init(); // setup state @@ -354,6 +355,10 @@ TBUIContext::Discard() void TBUIContext::FrameUpdate(const Graphics::FrameContext& ctx) { + if (views.IsEmpty()) + { + return; + } tb::TBMessageHandler::ProcessMessages(); tb::TBAnimationManager::Update(); @@ -417,12 +422,16 @@ bool TBUIContext::ProcessInput(const Input::InputEvent& inputEvent) { if (views.IsEmpty()) + { return false; + } TBUIView* view = views.Back(); if (!view) + { return false; + } tb::MODIFIER_KEYS modifiers = GetModifierKeys(); @@ -481,12 +490,12 @@ TBUIContext::ProcessInput(const Input::InputEvent& inputEvent) /** */ void -TBUIContext::Render( - const CoreGraphics::CmdBufferId cmdBuf, const Math::rectangle& viewport, const IndexT frame, const IndexT bufferIndex -) +TBUIContext::Render(const CoreGraphics::CmdBufferId cmdBuf, const Math::rectangle& viewport, const IndexT frame, const IndexT bufferIndex) { if (views.IsEmpty()) + { return; + } Util::Array batches;