Bug 243915 - EnvironmentTab: Bad multi access: MultiConfigDescription.getBuildSetting()
Summary: EnvironmentTab: Bad multi access: MultiConfigDescription.getBuildSetting()
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 5.0   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-12 13:38 EDT by James Blackburn CLA
Modified: 2020-09-04 15:26 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Blackburn CLA 2008-08-12 13:38:43 EDT
Build ID: 5.0

Steps To Reproduce:
I'm seeing the following error printed to stdout when editing environment on multiple configurations simultanously:
"Bad multi access: MultiConfigDescription.getBuildSetting"


More information:
Backtrace:

Thread [main] (Suspended (breakpoint at line 114 in MultiConfigDescription))	
	owns: WorkspaceModifyDelegatingOperation  (id=229)	
	MultiConfigDescription.getBuildSetting() line: 114	
	BuildSystemEnvironmentSupplier.getVariables(Object) line: 181	
	EnvironmentVariableManager.getVariables(IEnvironmentContextInfo, boolean) line: 274	
	ContributedEnvironment.getVariables(ICConfigurationDescription) line: 74	
	MultiCfgContributedEnvironment.getVariables(ICConfigurationDescription) line: 116	
	EnvironmentTab.performApply(ICResourceDescription, ICResourceDescription) line: 353	
	EnvironmentTab(AbstractCPropertyTab).handleTabEvent(int, Object) line: 521	
	Page_Environment(AbstractPage).forEach(int, Object) line: 867	
	AbstractPage$5.run(IProgressMonitor) line: 562	
	WorkspaceModifyDelegatingOperation.execute(IProgressMonitor) line: 69	
	WorkspaceModifyOperation$1.run(IProgressMonitor) line: 104	
	Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1800	
	WorkspaceModifyDelegatingOperation(WorkspaceModifyOperation).run(IProgressMonitor) line: 116	
	ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor) line: 446	
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 354	
	ProgressMonitorDialog.run(boolean, boolean, IRunnableWithProgress) line: 507	
	Page_Environment(AbstractPage).performSave(int) line: 581	
	Page_Environment(AbstractPage).performApply() line: 436	
	PreferencePage$2.widgetSelected(SelectionEvent) line: 284	
	TypedListener.handleEvent(Event) line: 228	
	EventTable.sendEvent(Event) line: 84	
	Button(Widget).sendEvent(Event) line: 1158	
	Display.runDeferredEvents() line: 3401	
	Display.readAndDispatch() line: 3033	
	PropertyDialog(Window).runEventLoop(Shell) line: 825	
	PropertyDialog(Window).open() line: 801	
	PropertyDialogAction.run() line: 157	
	PropertyDialogAction(Action).runWithEvent(Event) line: 498	
	ActionContributionItem.handleWidgetSelection(Event, boolean) line: 583	
	ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 500	
	ActionContributionItem$5.handleEvent(Event) line: 411	
	EventTable.sendEvent(Event) line: 84	
	MenuItem(Widget).sendEvent(Event) line: 1158	
	Display.runDeferredEvents() line: 3401	
	Display.readAndDispatch() line: 3033	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2382	
	Workbench.runUI() line: 2346	
	Workbench.access$4(Workbench) line: 2198	
	Workbench$5.run() line: 493	
	Realm.runWithDefault(Realm, Runnable) line: 288	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 488	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 113	
	EclipseAppHandle.run(Object) line: 193	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 382	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 549	
	Main.basicRun(String[]) line: 504	
	Main.run(String[]) line: 1236	
	Main.main(String[]) line: 1212
Comment 1 James Blackburn CLA 2008-08-12 14:52:03 EDT
Hmm.

The cause seems to be that EnvironmentTab cache's the isMulti flag in:

	protected void updateData(ICResourceDescription _cfgd) {
		// null means preference configuration 
		cfgd = (_cfgd != null) ? _cfgd.getConfiguration() : null;
		if (cfgd == null && vars == null)
			vars = fUserSupplier.getWorkspaceEnvironmentCopy();
		else
			ce.setMulti(page.isMultiCfg());
		updateData();
	}


updateData is called when the configuration changes only if the tab is visible (in my case, I've got another tab in the Environment tab group):

	/**
	 * Called when user changes 
	 * @param cfg - selected configuration
	 */
	private void configChanged(ICResourceDescription cfg) {
		if (visible) updateData(cfg);
	}


	public void handleTabEvent (int kind, Object data) {
		switch(kind) {
                ....
		case ICPropertyTab.APPLY:
			if (canBeVisible()) performApply(getResDesc(), (ICResourceDescription)data);
			break;

This means it's possible for performApply to occur even if updateData hasn't occurred.

I'm not sure whether the correct fix is to call updateData(src) first.  Or call updateData(...) from within EnvironmentTab's performApply method.  It's confusing that the same ICResourceDescription is being passed to performApply(src, dest) as for updateData. Both of these are page.getResDesc() which is accessible from classes derived from AbstractCPropertTab anyway...