diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-14 19:19:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-15 11:18:33 +0200 |
commit | 514bc435cd9c8f8f7c4fb31f2bbfde80ed667fe6 (patch) | |
tree | 434c4b166c018c01466f1c2aa47b2d46db362e67 | |
parent | c28ab0010916f8916134898724deeb96cced9a7f (diff) |
allow queue_draw/Invalidate before drawing area is set
Change-Id: I6cd58a340ea57ca2b212114d81f2cc5b774a095b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94253
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/vcl/customweld.hxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx index 74792fb266f1..85829f35d6ff 100644 --- a/include/vcl/customweld.hxx +++ b/include/vcl/customweld.hxx @@ -44,10 +44,17 @@ public: void SetOutputSizePixel(const Size& rSize) { m_aSize = rSize; } virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) { m_pDrawingArea = pDrawingArea; } weld::DrawingArea* GetDrawingArea() const { return m_pDrawingArea; } - void Invalidate() { m_pDrawingArea->queue_draw(); } + void Invalidate() + { + if (!m_pDrawingArea) + return; + m_pDrawingArea->queue_draw(); + } static bool IsUpdateMode() { return true; } void Invalidate(const tools::Rectangle& rRect) { + if (!m_pDrawingArea) + return; m_pDrawingArea->queue_draw_area(rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight()); } @@ -87,7 +94,12 @@ public: { m_pDrawingArea->set_size_request(nWidth, nHeight); } - void queue_resize() { m_pDrawingArea->queue_resize(); } + void queue_resize() + { + if (!m_pDrawingArea) + return; + m_pDrawingArea->queue_resize(); + } CustomWidgetController() : m_pDrawingArea(nullptr) { |