Issue 106277 - [From Symphony]ComboBox event can't work well in MacOSX
[From Symphony]ComboBox event can't work well in MacOSX
Status: CONFIRMED
Product: App Dev
Classification: Unclassified
Component: vba
OOo 3.3 or older
All All
: P3 trivial
: ---
Assigned To: Chen Peng
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-26 10:57 UTC by lihuiibm
Modified: 2013-02-24 20:56 UTC (History)
1 user (show)

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


Attachments
Patch for this issue (1.14 KB, patch)
2009-10-26 10:58 UTC, lihuiibm
no flags Details | Diff
Test case sample file for this issue (67.50 KB, text/plain)
2009-10-26 10:59 UTC, lihuiibm
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description lihuiibm 2009-10-26 10:57:59 UTC
Root Cause:
In the sample, we call VBA API to switch to another sheet in the selection
changed event of ComboBox, when switch to another sheet, all the control in
current sheet will be disposed, that causes OO3 crashes.

Resolution:
Store the variable ImplListBox* pOldLB = mpImplLB; After Modify() is called, we
check if the mpImplLB is disposed or not:
if (ImplGetWindowImpl() != NULL && mpImplLB != NULL && pOldLB == mpImplLB) 
{
...
}
Comment 1 lihuiibm 2009-10-26 10:58:27 UTC
Created attachment 65612 [details]
Patch for this issue
Comment 2 lihuiibm 2009-10-26 10:59:10 UTC
Created attachment 65613 [details]
Test case sample file for this issue
Comment 3 lihuiibm 2009-10-29 11:01:40 UTC
The reason of this fix:
In the VBA codes, we activate another sheet in the change event of ComboBox,
that cause this ComboBox control being disposed, because in OOo, when we switch
to another sheet, all the form control in current sheet will be disposed:
Private Sub ComboBox1_Change()
	Worksheets(ComboBox1.Text).Activate
End Sub

We fire the ComboBox_Change VBA event in the method of ComboBox:: Modify(),
after ComboBox:: Modify() was called, this ComboBox was disposed, so once
Select() is called, OOo crash. We store the variable: ImplListBox* pOldLB =
mpImplLB, before Modify() is called, after Modify() is called, we check if
pOldLB == mpImplLB, if these two variables are not equal, that means, this
ComboBox has been disposed.
combobox.cxx:
IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
{
	...
	if ( bCallSelect )
	{
		ImplListBox* pOldLB = mpImplLB;
		mpSubEdit->SetModifyFlag();
		mbSyntheticModify = TRUE;
		Modify();
		mbSyntheticModify = FALSE;
		if (ImplGetWindowImpl() != NULL && mpImplLB != NULL && pOldLB == mpImplLB)
		{
			Select();
		}
	}
	...
}
Comment 4 noel.power 2009-11-13 10:39:26 UTC
needs cws npower12 ( for the api ) and ab71 for the fake event handling to be in
place before this can be upstreamed, after that probably pl ( vcl guru )  needs
to review this fix, please take ownership for now
Comment 5 noel.power 2009-11-16 11:02:16 UTC
>needs cws npower12 ( for the api ) and ab71 for the fake event handling
actually seems like it just needs ab71