diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-20 14:38:29 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-10-26 22:40:42 +0200 |
commit | 47989d35a5ed3736ca3d30b0a34fc74c48755ddc (patch) | |
tree | 580ad67af8a4c43143f6a3270b722d990e1e61ab /vcl | |
parent | 7c556b9385d503fb9d03a274e4add54537b7ac9e (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/+/158168
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 70930a1267c0..badf271e9521 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -17257,6 +17257,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: @@ -17311,7 +17317,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(); } |