diff --git a/src/selection_dialog.cpp b/src/selection_dialog.cpp index 2565278..7e4f6bb 100644 --- a/src/selection_dialog.cpp +++ b/src/selection_dialog.cpp @@ -137,6 +137,14 @@ SelectionDialogBase::SelectionDialogBase(Source::BaseView *view_, const boost::o }); } +SelectionDialogBase::~SelectionDialogBase() { +#if defined(__APPLE__) && GTK_VERSION_GT_MICRO(3, 24, 34) + // Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/5593 by keeping window alive slightly longer + window.close(); + Glib::signal_timeout().connect([window = std::make_shared(std::move(window))] { return false; }, 5000); +#endif +} + void SelectionDialogBase::cursor_changed() { if(!is_visible()) return; diff --git a/src/selection_dialog.hpp b/src/selection_dialog.hpp index 39f0926..6b7bb0b 100644 --- a/src/selection_dialog.hpp +++ b/src/selection_dialog.hpp @@ -39,7 +39,7 @@ class SelectionDialogBase { public: SelectionDialogBase(Source::BaseView *view, const boost::optional &start_iter, bool show_search_entry, bool use_markup); - virtual ~SelectionDialogBase() {} + virtual ~SelectionDialogBase(); void add_row(const std::string &row); void erase_rows(); void set_cursor_at_last_row(); diff --git a/src/tooltips.cpp b/src/tooltips.cpp index ce7dec2..b62335a 100644 --- a/src/tooltips.cpp +++ b/src/tooltips.cpp @@ -19,6 +19,13 @@ Tooltip::Tooltip(std::function set_buffer_) : view(nullptr), set_buffer(std::move(set_buffer_)) {} Tooltip::~Tooltip() { +#if defined(__APPLE__) && GTK_VERSION_GT_MICRO(3, 24, 34) + // Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/5593 by keeping window alive slightly longer + if(window) { + window->close(); + Glib::signal_timeout().connect([window = std::shared_ptr(std::move(window))] { return false; }, 5000); + } +#endif Tooltips::shown_tooltips.erase(this); } diff --git a/tests/stubs/selection_dialog.cpp b/tests/stubs/selection_dialog.cpp index f561b0e..76d1c6d 100644 --- a/tests/stubs/selection_dialog.cpp +++ b/tests/stubs/selection_dialog.cpp @@ -5,6 +5,8 @@ SelectionDialogBase::ListViewText::ListViewText(bool use_markup) {} SelectionDialogBase::SelectionDialogBase(Source::BaseView *view, const boost::optional &start_iter, bool show_search_entry, bool use_markup) : view(view), list_view_text(use_markup) {} +SelectionDialogBase::~SelectionDialogBase() {} + void SelectionDialogBase::show() {} void SelectionDialogBase::hide() {}