After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749012 - GtkStack: Don't emit notify::visible-child during destruction
GtkStack: Don't emit notify::visible-child during destruction
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-05-06 13:19 UTC by Debarshi Ray
Modified: 2016-12-19 23:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkStack: Don't emit notify::visible-child during destruction (2.09 KB, patch)
2015-05-06 13:21 UTC, Debarshi Ray
none Details | Review
Sample program (884 bytes, text/plain)
2015-05-06 13:24 UTC, Debarshi Ray
  Details
GtkStack: Don't emit notify::visible-child during destruction (1.19 KB, patch)
2015-05-06 14:04 UTC, Debarshi Ray
committed Details | Review
GtkStack: Remove redundant code (1.50 KB, patch)
2016-12-12 20:21 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2015-05-06 13:19:09 UTC
GtkStack emits notify::visible-child during destruction - after dispose is run and before finalize. This can be a bit surprising for applications [1]. So either it shouldn't do that, or it should be clearly documented. If possible, I would prefer the former.

[1] https://git.gnome.org/browse/gnome-photos/tree/src/photos-embed.c#n576
Comment 1 Debarshi Ray 2015-05-06 13:21:11 UTC
Created attachment 302978 [details] [review]
GtkStack: Don't emit notify::visible-child during destruction
Comment 2 Debarshi Ray 2015-05-06 13:24:34 UTC
Created attachment 302979 [details]
Sample program
Comment 3 Emmanuele Bassi (:ebassi) 2015-05-06 13:38:29 UTC
Review of attachment 302978 [details] [review]:

::: gtk/gtkstack.c
@@ +214,3 @@
+  GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
+
+  priv->destroyed = TRUE;

Instead of doing this dance, why not unsetting the visible child during dispose()?
Comment 4 Debarshi Ray 2015-05-06 14:04:57 UTC
Created attachment 302981 [details] [review]
GtkStack: Don't emit notify::visible-child during destruction

By the way, given that this changes the run-time behaviour, is it suitable for gtk-3-16?
Comment 5 Matthias Clasen 2015-05-07 10:41:54 UTC
Review of attachment 302981 [details] [review]:

Looks good to me.

Wrt to 3.16, I think this is in 'try it and see if anything breaks' area.
Comment 6 Debarshi Ray 2015-05-07 13:21:16 UTC
Comment on attachment 302981 [details] [review]
GtkStack: Don't emit notify::visible-child during destruction

Pushed to both master and gtk-3-16.

I am not picky about having it in gtk-3-16, because I already have the workaround in place.
Comment 7 Debarshi Ray 2016-12-12 20:20:50 UTC
Turns out that I stepped on Paolo's toes here.

(In reply to Emmanuele Bassi (:ebassi) from comment #3)
> Review of attachment 302978 [details] [review] [review]:
> 
> ::: gtk/gtkstack.c
> @@ +214,3 @@
> +  GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
> +
> +  priv->destroyed = TRUE;
> 
> Instead of doing this dance, why not unsetting the visible child during
> dispose()?

He submitted the same patch (bug 724506) but it got committed after mine (as commit 4e155d784dda384cd4bba6653134b1a0542ee569), which was later fixed up by Matthias (as commit 7ce96cb6ac28eeb62e003dcb9e0a8ce7d48e09e0).

Hence, I don't think my patch is needed anymore.
Comment 8 Debarshi Ray 2016-12-12 20:21:27 UTC
Created attachment 341845 [details] [review]
GtkStack: Remove redundant code
Comment 9 Matthias Clasen 2016-12-19 20:06:04 UTC
Review of attachment 341845 [details] [review]:

ok
Comment 10 Debarshi Ray 2016-12-19 23:36:14 UTC
Comment on attachment 341845 [details] [review]
GtkStack: Remove redundant code

Pushed only to master.