Skip to content

Replace dialog: Fix an overlapping signals issue

This fixes an issue that can occurs when the replace dialog is opened several times: changing some settings can break the dialog box, with various effects, like buttons that substitute each other or disappearance of check boxes.

This is due to a lack of signals disconnection, that makes them overlap as the dialog box is closed and reopened.

Here are the steps to reproduce to systematically obtain some effects (at least on my system):

  • select some text
  • open the replace dialog
  • if "replace-all" is not checked, check it, else simply close the dialog box
  • reopen the replace dialog and uncheck "replace-all"

Also open mousepad in a terminal, to see that pointers no longer point to the right objects.
You should see something like this:

(mousepad:28908): GLib-GObject-WARNING **: 19:31:22.849: invalid unclassed pointer in cast to 'GtkEntry'

(mousepad:28908): Gtk-CRITICAL **: 19:31:22.849: gtk_entry_get_text: assertion 'GTK_IS_ENTRY (entry)' failed

(mousepad:28908): Mousepad-CRITICAL **: 19:31:22.849: mousepad_util_entry_error: assertion 'GTK_IS_WIDGET (widget)' failed

Edited by Gaël Bonithon

Merge request reports