diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-08-21 17:04:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-22 16:23:14 +0200 |
commit | 0f6457b1e867c49bc82f2b18e2e462fb7100051f (patch) | |
tree | 500430f8d8bbfd7fa1a2d49430aa8c7c443ce337 /vcl/unx/gtk3 | |
parent | f30c3ff66a24d5031c077be0cb839f5f249c188e (diff) |
don't store vcl::Font with unique_ptr
it is already a COW object, so just use std::optional
Change-Id: I5ced54dbf3dc222316d9bcf3581b36e0f6e6e270
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120818
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 8b7780c92cbb..fc56dfaecda0 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -8970,7 +8970,7 @@ class GtkInstanceButton : public GtkInstanceWidget, public virtual weld::Button private: GtkButton* m_pButton; gulong m_nSignalId; - std::unique_ptr<vcl::Font> m_xFont; + std::optional<vcl::Font> m_xFont; WidgetBackground m_aCustomBackground; static void signalClicked(GtkButton*, gpointer widget) @@ -9029,7 +9029,7 @@ public: virtual void set_font(const vcl::Font& rFont) override { - m_xFont.reset(new vcl::Font(rFont)); + m_xFont = rFont; GtkWidget* pChild = ::get_label_widget(GTK_WIDGET(m_pButton)); ::set_font(GTK_LABEL(pChild), rFont); } @@ -9497,7 +9497,7 @@ private: GtkWidget* m_pPopover; #if GTK_CHECK_VERSION(4, 0, 0) gulong m_nToggledSignalId; - std::unique_ptr<vcl::Font> m_xFont; + std::optional<vcl::Font> m_xFont; WidgetBackground m_aCustomBackground; #endif @@ -12059,7 +12059,7 @@ protected: GtkEditable* m_pEditable; GtkWidget* m_pDelegate; private: - std::unique_ptr<vcl::Font> m_xFont; + std::optional<vcl::Font> m_xFont; gulong m_nChangedSignalId; gulong m_nInsertTextSignalId; gulong m_nCursorPosSignalId; @@ -12308,7 +12308,7 @@ public: virtual void set_font(const vcl::Font& rFont) override { - m_xFont.reset(new vcl::Font(rFont)); + m_xFont = rFont; PangoAttrList* pOrigList = get_attributes(); PangoAttrList* pAttrList = pOrigList ? pango_attr_list_copy(pOrigList) : pango_attr_list_new(); update_attr_list(pAttrList, rFont); @@ -17419,7 +17419,7 @@ private: GtkEventController* m_pMenuKeyController; GtkEventController* m_pEntryFocusController; // std::unique_ptr<CustomRenderMenuButtonHelper> m_xCustomMenuButtonHelper; - std::unique_ptr<vcl::Font> m_xFont; + std::optional<vcl::Font> m_xFont; std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter; vcl::QuickSelectionEngine m_aQuickSelectionEngine; std::vector<std::unique_ptr<GtkTreeRowReference, GtkTreeRowReferenceDeleter>> m_aSeparatorRows; @@ -19162,7 +19162,7 @@ private: GtkWidget* m_pEntry; GtkCellView* m_pCellView; std::unique_ptr<CustomRenderMenuButtonHelper> m_xCustomMenuButtonHelper; - std::unique_ptr<vcl::Font> m_xFont; + std::optional<vcl::Font> m_xFont; std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter; vcl::QuickSelectionEngine m_aQuickSelectionEngine; std::vector<std::unique_ptr<GtkTreeRowReference, GtkTreeRowReferenceDeleter>> m_aSeparatorRows; @@ -20617,7 +20617,7 @@ public: virtual void set_entry_font(const vcl::Font& rFont) override { - m_xFont.reset(new vcl::Font(rFont)); + m_xFont = rFont; assert(m_pEntry); PangoAttrList* pOrigList = gtk_entry_get_attributes(GTK_ENTRY(m_pEntry)); PangoAttrList* pAttrList = pOrigList ? pango_attr_list_copy(pOrigList) : pango_attr_list_new(); |