Wed 18 Feb 2015 05:11:22 PM UTC, comment #13:
I just tested
The execution time is 4.85+/-0.1s with or without the patch, so yes, when there is no listener, the impact is negligible.
I don't see a practical case where listening "children" property may be useful, but as I showed this will cause listener functions to be called several times. Note that this is also true for other properties.
|
Wed 18 Feb 2015 04:55:08 PM UTC, comment #12:
Is there any performance hit to this patch? Or is it generally zero because adding a listener to the children property is infrequent?
|
Wed 18 Feb 2015 03:46:36 PM UTC, comment #11:
Thank you Ben, I pushed the changeset at http://hg.savannah.gnu.org/hgweb/octave/rev/99ef3e58214e.
Closing report.
|
Tue 17 Feb 2015 07:28:43 PM UTC, comment #10:
I applied you patch to the stable branch and it works for for me as well.
|
Tue 17 Feb 2015 06:34:23 PM UTC, comment #9:
Hi,
The attached patch fixes the issue for me. Using listeners on axes children property is a bit noisy (e.g. Octave internally deletes recreates text labels when "nextplot" is "replace"):
(file #33111)
|
Sun 15 Feb 2015 09:18:37 AM UTC, comment #8:
@Ben: yes it is possible on the c++ side to call "set" function without executing listeners and notifying toolkit. There are two boolean arguments that let you choose.
|
Sat 14 Feb 2015 04:45:43 PM UTC, comment #7:
I'm not exactly trustworthy when it comes to reading c++, but it looks to me as if the listeners are not called when the children are modified from the c++ side, which is what happens when a new object is added to a parent.
To check I tried the modified script below.
Running this script does trigger the listener.
Is it possible that listeners are only triggered when the associated property is modified from an m-file, or command line?
|
Sat 14 Feb 2015 03:50:25 PM UTC, comment #6:
Most properties XXX have their listener run in their corresponding set_XXX method. For some properties, the set_XXX is not generated automatically (marked S or s in the genprop.awk macro). Then the run_listeners method has to be added by hand to their specific set_XXX method. Maybe it has been forgotten for "children" properties ... I can't verify this guess now but if someone wants to investigate I'd watch in this direction.
|
Sat 14 Feb 2015 01:54:55 AM UTC, comment #5:
Until we understand why addlistener doesn't work for "children" I'd hesitate to reduce the severity.
|
Sat 14 Feb 2015 01:19:18 AM UTC, comment #4:
Can we lower the priority to minor? Or is there a compelling use case for listeners on the "children" property of graphics objects?
|
Sat 14 Feb 2015 01:12:36 AM UTC, comment #3:
I think the Matlab version of addlistener() is for classdef objects.
http://www.mathworks.com/help/matlab/ref/handle.addlistener.html
|
Sat 14 Feb 2015 12:27:13 AM UTC, comment #2:
Matlab doesn't have a compatible addlistener() function. in R2014a,
|
Fri 13 Feb 2015 11:33:31 PM UTC, comment #1:
Does this work in Matlab? I expect so, but it would be nice to check.
|
Fri 13 Feb 2015 09:28:15 PM UTC, original submission:
When run, the example below should print "my_hander called" to the command line.
|