This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 262540 - OptionsPanelController: addPropertyChangeListener() called again and again with no corresponding removePropertyChangeListener()
Summary: OptionsPanelController: addPropertyChangeListener() called again and again wi...
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Templates (show other bugs)
Version: 8.1
Hardware: PC Windows 7 x64
: P1 normal with 1 vote (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-22 18:48 UTC by kmortensen
Modified: 2016-07-24 01:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Source code to recreate the bug (3.33 KB, application/x-zip-compressed)
2016-06-22 18:48 UTC, kmortensen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kmortensen 2016-06-22 18:48:41 UTC
Created attachment 160139 [details]
Source code to recreate the bug

I followed this demo: https://platform.netbeans.org/tutorials/nbm-options.html and noticed the addPropertyChangeListener() in the generated OptionsPanelController was called repeatedly with no corresponding call to removePropertyChangeListener(). This occurs every time you open the Options Panel. The result is the valid() method in the options panel is called multiple times in a row. This can be rather problematic if validation takes a while (e.g. resolving some DNS or checking if a server is accessible, etc).

Even worse, it calls addPropertyChangeListener() every time you press the "Apply" button in the built-in options dialog! You can easily stack up a lot of repeated entries for property change notification.


(Not part of the actual bug, but related to the same code...)
I have had a few other struggles dealing with this same tutorial on the forums, but haven't gotten much traction. For what it's worth:
Hide help button:  http://forums.netbeans.org/viewtopic.php?t=66089&highlight=
Validate after OK is pressed:  http://forums.netbeans.org/viewtopic.php?t=66096&highlight=
Comment 1 kmortensen 2016-06-22 19:00:43 UTC
Interestingly, it appears to happen only after your custom panel has been lazy-loaded (if that's what's going on) e.g. if you don't click on your panel in the options menu, this doesn't happen. But once you click on it, it keeps happening.
Comment 2 kmortensen 2016-06-23 19:53:22 UTC
Possibly related to http://forums.netbeans.org/viewtopic.php?p=170746
Comment 3 Martin Entlicher 2016-07-22 16:54:57 UTC
Fixed by changeset:   299547:fb89be5cc6f9
http://hg.netbeans.org/core-main/rev/fb89be5cc6f9
Comment 4 Quality Engineering 2016-07-24 01:52:28 UTC
Integrated into 'main-silver', will be available in build *201607240002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/fb89be5cc6f9
User: mentlicher@netbeans.org
Log: #262540: Do not add one listener more than once.