Issue 120441 - [Freeze]With data range picker shrink in first document, AOO frozen if switch focus back from another SC doc
Summary: [Freeze]With data range picker shrink in first document, AOO frozen if switc...
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: editing (show other issues)
Version: 3.4.0
Hardware: All Windows 7
: P3 Critical (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-02 06:32 UTC by Yan Ji
Modified: 2013-06-07 07:21 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Fix patch for Bug 120441 (1.14 KB, patch)
2012-08-02 06:55 UTC, pengyunquan
yunquanp: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Yan Ji 2012-08-02 06:32:11 UTC
Build: AOO 3.4.1
OS: Windows
Steps:
1. New a Calc document.
2. Click "Inserte->Chart", click "Finish" button in guide dialog
3. Select the chart(in edit mode), choose "Data Range" in context menu.
4. Click the shrink button.
5. New another Calc document.
6. Switch back to the 1st document, and click on one cell 

Defect: The 1st document is locked, and can not respond to the user events
Comment 1 pengyunquan 2012-08-02 06:55:17 UTC
Created attachment 78817 [details]
Fix patch for Bug 120441

Root case : On creation of the 2nd Spreadsheet document, a ScSimpleRefDlgWrapper object will be constructed. In its constructor, there are several lines of code cause this problem:
	if(bAutoReOpen && pViewShell)
		pWindow = pViewShell->CreateRefDialog( p, this, pInfo, pParentP, WID_SIMPLE_REF);

	if (!pWindow)
	{
		SC_MOD()->SetRefDialog( nId, sal_False );
	}
 The 2nd document does not have a reference picker dialog, so "SC_MOD()->SetRefDialog( nId, sal_False );" is executed, which clears ScModule's reference status.  This is an incorrect action, because the 1st document still has a reference dialog open, and ScModule should keep reference status while there are one document is in reference picking status.  On the 2nd document's creation, only its own reference status should be cleared, so we should call "pViewFrm->SetChildWindow( nId, sal_False );" instead of "SC_MOD()->SetRefDialog( nId, sal_False );". 
    Let's see other child dialog wrappers' constructor. In "ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper(...)", it is "pViewShell->GetViewFrame()->SetChildWindow( nId, sal_False );" not "SC_MOD()->SetRefDialog( nId, sal_False );". As a result, it does not cause this problem.
    Why "SC_MOD()->SetRefDialog( nId, sal_False );" cause frozen problem? Because once ScModule's reference picking status is cleared, when mouse is clicked on one cell in the 1st document, the ScModule does not think this is a reference picking action, and the ScModule thinks it is a normal mouse click on cell which will cause ScCellShell be activated and ScChartShell will be deactivated. As a result, reference picker dialog will be destroyed, and its parent dialog( Chart Range dialog ) will be set as foreground dialog. The original parent dialog of the Chart Range dialog is the CharWindow, but now the ChartWindow is destroyed when ScChartShell is deactivated, the ChartRange dialog will be reparented to ScGridWindow. in VCL, reparent a frame window will destroy the system window handle( HWND ), and recreated a new HWND. But the window position is not inherited from the original HWND, so when show the new window, system API "GetWindowRect" get rectangle as "Rectangle(0,0,0,0)". As a result, we can not see the new foreground ChartRange dialog, but it is a modal dialog whick locks the document, and the ScGridWindow can not respond to the user events. The document looks like frozen. By the way, we can not close the invisible foreground dialog (Chart Range dialog ) by pressing "Esc" key, because when this dialog is reparented to ScGridWindow VCL calls "ShowWindow( .., SW_NOACTVATE)", which means the foreground dialog does not get focus. It is a invisible modal dialog without focus, which locks the docuemt and can not be closed via "Esc" key.
Comment 2 liuping 2013-06-07 07:21:05 UTC
I can't reproduct on AOO400m2(Build:9701)  -  Rev. 1489073 on Wind7 OS becasue fixed by comments 2