From 1b13bf607f7fe3ba484878fae69495ba7720b995 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 3 Nov 2024 02:49:06 +0100 Subject: [PATCH] Micro optimization: only queue resize when widget is realized --- gtk2_ardour/audio_clock.cc | 5 ++++- gtk2_ardour/rec_info_box.cc | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 6f3f7021fd..754743b198 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -2387,7 +2387,10 @@ AudioClock::dpi_reset () */ first_width = 0; first_height = 0; - queue_resize (); + + if (get_realized ()) { + queue_resize (); + } } void diff --git a/gtk2_ardour/rec_info_box.cc b/gtk2_ardour/rec_info_box.cc index 3725717a66..df30121cab 100644 --- a/gtk2_ardour/rec_info_box.cc +++ b/gtk2_ardour/rec_info_box.cc @@ -116,7 +116,9 @@ DurationInfoBox::dpi_reset () _layout_value->get_pixel_size (wv, hv); _width = 8 + wv; _height = 4 + hv; - queue_resize (); + if (get_realized ()) { + queue_resize (); + } } void @@ -198,7 +200,9 @@ XrunInfoBox::dpi_reset () _layout_value->get_pixel_size (wv, hv); _width = 8 + wv; _height = 8 + hv; - queue_resize (); + if (get_realized ()) { + queue_resize (); + } } void @@ -291,7 +295,9 @@ RemainInfoBox::dpi_reset () _width = 8 + std::max (wl, wv); _height = 2 + hv + 2 + hl + 2; - queue_resize (); + if (get_realized ()) { + queue_resize (); + } } void