Disconnect some more signals on widgets destruction (#4379)

This is applicable to any signals where emitter's lifetime isn't
controlled by the receiver.

There're still about 7 `Glib::signal_idle()` connections which aren't
tracked but I see the possibility of it leading to major issues as quite
low.
This commit is contained in:
Mike Gelfand
2022-12-16 09:40:28 -08:00
committed by GitHub
parent e6d75a4b77
commit 0824c2da6d
5 changed files with 38 additions and 36 deletions

View File

@@ -168,7 +168,6 @@ private:
Glib::Quark const URL_ENTRY_KEY = Glib::Quark("tr-url-entry-key");
static guint last_page_;
sigc::connection last_page_tag_;
};
guint DetailsDialog::Impl::last_page_ = 0;
@@ -2502,7 +2501,6 @@ void DetailsDialog::Impl::on_details_window_size_allocated()
DetailsDialog::Impl::~Impl()
{
periodic_refresh_tag_.disconnect();
last_page_tag_.disconnect();
}
std::unique_ptr<DetailsDialog> DetailsDialog::create(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
@@ -2589,7 +2587,7 @@ DetailsDialog::Impl::Impl(DetailsDialog& dialog, Glib::RefPtr<Gtk::Builder> cons
auto* const n = gtr_get_widget<Gtk::Notebook>(builder, "dialog_pages");
n->set_current_page(last_page_);
last_page_tag_ = n->signal_switch_page().connect([](Widget*, guint page) { DetailsDialog::Impl::last_page_ = page; });
n->signal_switch_page().connect([](Gtk::Widget* /*page*/, guint page_number) { last_page_ = page_number; });
}
void DetailsDialog::set_torrents(std::vector<tr_torrent_id_t> const& ids)