summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-20 14:38:29 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-21 17:16:57 +0200
commita8c30238bc91f7bb7a5462c608eb27dd74c73db0 (patch)
tree2354bc39e7370dd8328517b4fbaa0be907141d88
parentd861fff5e3419e28edcfdf17c4863ec8c9618502 (diff)
Resolves: tdf#157849 gtk_spin_button_update callback can delete widget
so later GtkInstanceEditable::signal_activate is on deleted widget Change-Id: I9bb9848b4554792db11fc7b0e2d3491a94975b3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158262 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 12519a8dfd93..aaddf24bce32 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17324,6 +17324,12 @@ IMPL_LINK_NOARG(GtkInstanceIconView, async_signal_selection_changed, void*, void
namespace {
+void signalDestroyFlag(GtkWidget*, gpointer destroyed)
+{
+ bool* pDestroyed = static_cast<bool*>(destroyed);
+ *pDestroyed = true;
+}
+
class GtkInstanceSpinButton : public GtkInstanceEditable, public virtual weld::SpinButton
{
private:
@@ -17378,7 +17384,12 @@ private:
virtual void signal_activate() override
{
+ bool bActivateDestroy(false);
+ gulong nDestroySignalId = g_signal_connect(m_pButton, "destroy", G_CALLBACK(signalDestroyFlag), &bActivateDestroy);
gtk_spin_button_update(m_pButton);
+ if (bActivateDestroy)
+ return;
+ g_signal_handler_disconnect(m_pButton, nDestroySignalId);
GtkInstanceEditable::signal_activate();
}