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.
Summary: | Original Current Path is restored after changing | ||
---|---|---|---|
Product: | cnd | Reporter: | Alexander Pepin <apepin> |
Component: | -- Other -- | Assignee: | Thomas Preisler <thp> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | Keywords: | REGRESSION |
Priority: | P1 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | Windows XP | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Alexander Pepin
2007-10-30 16:56:34 UTC
I think I found the root cause of the bug: CppSettings is supposed to be singleton but public static CppSettings getDefault() { return (CppSettings) findObject(CppSettings.class, true); } sometimes returns a new and reinitialized object. This may be a regression but I don't think it is caused by any changes in CND though. Strange. Fix is to change the code to public static CppSettings getDefault() { return (CppSettings) findObject(CppSettings.class, true); if (cppSettings == null) { cppSettings = (CppSettings) findObject(CppSettings.class, true); } return cppSettings; which ensures there is only one singleton. Patch: # This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: cnd/core/src/org/netbeans/modules/cnd/settings/CppSettings.java --- cnd/core/src/org/netbeans/modules/cnd/settings/CppSettings.java Base (1.9) +++ cnd/core/src/org/netbeans/modules/cnd/settings/CppSettings.java Locally Modified (Based On 1.9) @@ -96,6 +96,7 @@ private String path = null; + private static CppSettings cppSettings = null; /** Initialize each property */ protected void initialize() { @@ -107,8 +108,11 @@ /** Return the signleton cppSettings */ public static CppSettings getDefault() { - return (CppSettings) findObject(CppSettings.class, true); + if (cppSettings == null) { + cppSettings = (CppSettings) findObject(CppSettings.class, true); } + return cppSettings; + } /** * Return the local version of $PATH. This masquerades as a property but isn't! Fixed. verified in build 200710310000 |