Possible bug - MDI Workspace closing parent chil

Topics: CAB & Smart Client Software Factory
Dec 12, 2006 at 10:05 AM
originally posted by: BrianRogers

Hi everyone,

I think this may be a possible bug. Any feedback is appreciated.

My application structure uses the MDI workspace. A parent form (work item) creates a child form (work item). To prevent the form from closing and not terminating the work item, all forms have closing event handlers (as opposed to using the smart part closing where one form closing could cause multiple smartpart closing events ??). Closing a form in a work item that is not terminated, calls the work item terminate method.

The bug occurs in the following situation:
Closing the parent form before the child form causes an error. Closing the parent causes it to be removed from the workspace. The lifetime container policy breaks down the child, but after closing, the workspace attempts to activate the parent (form) which no longer exists in the workspace.

Adding a test in the WindowDockContentActivated method as follows fixed the bug.

if ((fireActivatedFromForm) && (this.InnerSmartParts.Contains(e.SmartPart as Control)))

Thanks,
B.