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 759995 - Destroying children and output proxies after the parent leads to WARNINGs
Destroying children and output proxies after the parent leads to WARNINGs
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2015-12-30 10:11 UTC by Debarshi Ray
Modified: 2015-12-30 17:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Reproducer (1.40 KB, text/plain)
2015-12-30 10:11 UTC, Debarshi Ray
  Details
GeglNode: Stop listening to signals from proxy nodes after destruction (1.34 KB, patch)
2015-12-30 10:29 UTC, Debarshi Ray
committed Details | Review
GeglNode: Disconnect "invalidated" handler when the sink pad is gone (1.30 KB, patch)
2015-12-30 10:37 UTC, Debarshi Ray
reviewed Details | Review

Description Debarshi Ray 2015-12-30 10:11:15 UTC
Created attachment 318023 [details]
Reproducer

This is caused by a combination of these two cases:

(i) Since GeglProcessor currently doesn't handle non-meta-op sub-graphs transparently (see bug 759619), applications use the output proxy to create the processor. The output proxy can outlive its parent if the processor is destroyed after the parent.

(ii) The application keeps its own references on the children of the sub-graph, and drops those references after dropping the reference on the sub-graph. eg., in my Pipeline class, I have a GHashTable that maps operation names to GeglNodes, and it keeps its own references on the nodes, and I unref the hashtable after unreffing the sub-graph during destruction.

See the attached reproducer.
Comment 1 Debarshi Ray 2015-12-30 10:15:21 UTC
The actual WARNING and CRITICAL:

GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GeglNode'
GEGL-gegl-node.c-CRITICAL **: gegl_node_invalidated: assertion 'GEGL_IS_NODE (node)' failed
Comment 2 Debarshi Ray 2015-12-30 10:29:22 UTC
Created attachment 318024 [details] [review]
GeglNode: Stop listening to signals from proxy nodes after destruction
Comment 3 Debarshi Ray 2015-12-30 10:31:07 UTC
I would have written a test, but I can't get the test suite to fail by any means other than setting G_DEBUG=fatal-warnings in run-tests.py. Setting the variable in C doesn't work. I don't know why.
Comment 4 Debarshi Ray 2015-12-30 10:37:34 UTC
Created attachment 318025 [details] [review]
GeglNode: Disconnect "invalidated" handler when the sink pad is gone

Although this seems to be the right thing to do, I haven't found a real world need for it.
Comment 5 Debarshi Ray 2015-12-30 14:07:27 UTC
From #gegl on GIMPNet:

10:51 <rishi> mitch_: pippin: What do you think of                              
      https://bugzilla.gnome.org/show_bug.cgi?id=759995 ?
...
<some discussion ensues>
...
12:22 <pippin> rishi: if your fixes for the reference managed behavior doesn't  
      change any other behavior, feel free to push
Comment 6 Debarshi Ray 2015-12-30 14:08:39 UTC
Review of attachment 318025 [details] [review]:

This is purely a theoretical case at the moment, so I am not pushing it now.
Comment 7 Debarshi Ray 2015-12-30 17:32:56 UTC
commit 8515991978c6da714815f0022fa6d2a57d7a4994
Author: Debarshi Ray <debarshir@gnome.org>
Date:   Wed Dec 30 10:49:11 2015 +0100

    GeglNode: Stop listening to signals from proxy nodes after destruction
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759995