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 121742 - TopComponent.canClose() called twice.
Summary: TopComponent.canClose() called twice.
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker with 1 vote (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-12 15:34 UTC by mgoe
Modified: 2009-02-19 22:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Module suite project showing the issue. (6.62 KB, application/x-gzip)
2007-11-12 15:38 UTC, mgoe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mgoe 2007-11-12 15:34:03 UTC
When closing a TopComponent in an Installer extending ModuleInstall as follows:

    @Override
    public void close() {
        Set<TopComponent> openComponents = TopComponent.getRegistry().getOpened();
        for (TopComponent tc : openComponents) {
            tc.close();
        }
    }

the method TopComponent.canClose() is called twice if true is returned the first time. Since returning false the 
second time does not have any visible effect (the TopComponent has been closed anyway) I would rate this behavior as a 
bug. I created a small module suite project which shows the problem.
Comment 1 mgoe 2007-11-12 15:38:49 UTC
Created attachment 52885 [details]
Module suite project showing the issue.
Comment 2 Petr Chytil 2008-04-11 10:20:06 UTC
reassigning to openide/window system
Comment 3 vakuumbarn 2008-07-08 10:19:49 UTC
Confirming this bug as we encounter the same problem with our NetBeans Platform Application. It causes problems with
application logic trying to decide whether or not to close the TopComponent.

We currently display a "Save, Don't save, Cancel" popup in canClose and the bug causes this to popup twice if anything
but cancel is clicked.
Comment 4 Stanislav Aubrecht 2008-12-11 09:13:08 UTC
fixed

bd9a3adffdeb
Comment 5 Quality Engineering 2008-12-12 05:56:01 UTC
Integrated into 'main-golden', will be available in build *200812120201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/bd9a3adffdeb
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #121742 - TopComponent.canClose() called twice.