[gnote/gnome-40] Fix crash when closing window with open note containing selection
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote/gnome-40] Fix crash when closing window with open note containing selection
- Date: Sat, 29 May 2021 17:50:07 +0000 (UTC)
commit 1b80ebcb1e7cf3d71e23eb4c368095388ce36abb
Author: Aurimas Černius <aurisc4 gmail com>
Date: Thu May 6 23:20:16 2021 +0300
Fix crash when closing window with open note containing selection
src/notewindow.cpp | 13 ++++---------
src/notewindow.hpp | 1 -
2 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 66d22fb8..6b4197a0 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -121,9 +121,6 @@ namespace gnote {
m_editor->signal_populate_popup().connect(sigc::mem_fun(*this, &NoteWindow::on_populate_popup));
m_editor->show();
- // Sensitize the Link toolbar button on text selection
- m_mark_set_timeout = new utils::InterruptableTimeout();
- m_mark_set_timeout->signal_timeout.connect(sigc::mem_fun(*m_text_menu, &NoteTextMenu::refresh_state));
note.get_buffer()->signal_mark_set().connect(
sigc::mem_fun(*this, &NoteWindow::on_selection_mark_set));
@@ -149,8 +146,6 @@ namespace gnote {
{
delete m_global_keys;
m_global_keys = NULL;
- delete m_mark_set_timeout;
- m_mark_set_timeout = NULL;
// make sure editor is NULL. See bug 586084
m_editor = NULL;
}
@@ -358,11 +353,11 @@ namespace gnote {
noteutils::show_deletion_dialog(single_note_list, dynamic_cast<Gtk::Window*>(host()));
}
- void NoteWindow::on_selection_mark_set(const Gtk::TextIter&, const Glib::RefPtr<Gtk::TextMark>&)
+ void NoteWindow::on_selection_mark_set(const Gtk::TextIter&, const Glib::RefPtr<Gtk::TextMark> & mark)
{
- // FIXME: Process in a timeout due to GTK+ bug #172050.
- if(m_mark_set_timeout) {
- m_mark_set_timeout->reset(0);
+ auto mark_name = mark->get_name();
+ if(mark_name == "insert" || mark_name == "selection_bound") {
+ m_text_menu->refresh_state();
}
}
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index df5f4f18..95c21eeb 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -266,7 +266,6 @@ private:
Gtk::CheckButton *m_save_title_check_button;
utils::GlobalKeybinder *m_global_keys;
- utils::InterruptableTimeout *m_mark_set_timeout;
bool m_enabled;
Tag::Ptr m_template_tag;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]