Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Nemkin2019-05-13 08:57:43 -0400
committerNikita Nemkin2019-06-14 04:32:54 -0400
commit13fb2739bfa6ffe9f8b07a725be5b55157c720c3 (patch)
tree76cff2f8fdbaea2100a763c293f58a7ee3f7d954
parent16cd9f79fdabe331e7ebe3ee5fcc6aea699adb4b (diff)
downloadeclipse.platform.swt-13fb2739bfa6ffe9f8b07a725be5b55157c720c3.tar.gz
eclipse.platform.swt-13fb2739bfa6ffe9f8b07a725be5b55157c720c3.tar.xz
eclipse.platform.swt-13fb2739bfa6ffe9f8b07a725be5b55157c720c3.zip
Bug 547475 - [Win32] Remove redundant COM interface vtables
In case of COM interface inheritance, derived interface vtable (COMObject instance) can be reused as a base interface vtable. This reuse doesn't affect object behavior in any way. Affected interfaces and their bases: * IAccessible2 : IAccessible * IAccessibleHyperlink : IAccessibleAction * IAccessibleHypertext : IAccessibleText * IEnumFORMATETC : IUnknown * IDIOleClientSite : IUnknown * IPropertyNotifySink : IUnknown Change-Id: If6b3bcdbe1515d75d561e5e7dca9d8cb6f8a93ba Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java207
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java20
5 files changed, 20 insertions, 269 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
index e895030392..8e87fab0c9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
@@ -58,10 +58,10 @@ public class Accessible {
static int UniqueID = -0x10;
int refCount = 0, enumIndex = 0;
Runnable timer;
- COMObject objIAccessible, objIEnumVARIANT, objIServiceProvider, objIAccessible2, objIAccessibleAction,
+ COMObject objIAccessible, objIEnumVARIANT, objIServiceProvider,
objIAccessibleApplication, /*objIAccessibleComponent,*/ objIAccessibleEditableText, objIAccessibleHyperlink,
objIAccessibleHypertext, /*objIAccessibleImage,*/ objIAccessibleTable2, objIAccessibleTableCell,
- objIAccessibleText, objIAccessibleValue; /* objIAccessibleRelation is defined in Relation class */
+ objIAccessibleValue; /* objIAccessibleRelation is defined in Relation class */
IAccessible iaccessible;
List<AccessibleListener> accessibleListeners;
List<AccessibleControlListener> accessibleControlListeners;
@@ -149,7 +149,7 @@ public class Accessible {
}
void createIAccessible() {
- objIAccessible = new COMObject(new int[] {2,0,0,1,3,5,8,1,1,2,2,2,2,2,2,2,3,2,1,1,2,2,5,3,3,1,2,2}) {
+ objIAccessible = new COMObject(new int[] {2,0,0,/*IA>>*/1,3,5,8,1,1,2,2,2,2,2,2,2,3,2,1,1,2,2,5,3,3,1,2,2,/*<<IA*/1,2,3,1,1,3,3,1,1,1,1,3,3,1,1,1,1,1}) {
@Override
public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
@Override
@@ -202,95 +202,6 @@ public class Accessible {
public long /*int*/ method26(long /*int*/[] args) {return put_accName(args[0], args[1]);}
@Override
public long /*int*/ method27(long /*int*/[] args) {return put_accValue(args[0], args[1]);}
- };
-
- /* If the callback takes a struct parameter (for example, a VARIANT),
- * then create a custom callback that dereferences the struct and
- * passes a pointer to the original callback.
- */
- long /*int*/ ppVtable = objIAccessible.ppVtable;
- long /*int*/[] pVtable = new long /*int*/[1];
- OS.MoveMemory(pVtable, ppVtable, C.PTR_SIZEOF);
- long /*int*/[] funcs = new long /*int*/[28];
- OS.MoveMemory(funcs, pVtable[0], C.PTR_SIZEOF * funcs.length);
- funcs[9] = COM.get_accChild_CALLBACK(funcs[9]);
- funcs[10] = COM.get_accName_CALLBACK(funcs[10]);
- funcs[11] = COM.get_accValue_CALLBACK(funcs[11]);
- funcs[12] = COM.get_accDescription_CALLBACK(funcs[12]);
- funcs[13] = COM.get_accRole_CALLBACK(funcs[13]);
- funcs[14] = COM.get_accState_CALLBACK(funcs[14]);
- funcs[15] = COM.get_accHelp_CALLBACK(funcs[15]);
- funcs[16] = COM.get_accHelpTopic_CALLBACK(funcs[16]);
- funcs[17] = COM.get_accKeyboardShortcut_CALLBACK(funcs[17]);
- funcs[20] = COM.get_accDefaultAction_CALLBACK(funcs[20]);
- funcs[21] = COM.accSelect_CALLBACK(funcs[21]);
- funcs[22] = COM.accLocation_CALLBACK(funcs[22]);
- funcs[23] = COM.accNavigate_CALLBACK(funcs[23]);
- funcs[25] = COM.accDoDefaultAction_CALLBACK(funcs[25]);
- funcs[26] = COM.put_accName_CALLBACK(funcs[26]);
- funcs[27] = COM.put_accValue_CALLBACK(funcs[27]);
- OS.MoveMemory(pVtable[0], funcs, C.PTR_SIZEOF * funcs.length);
- }
-
- void createIAccessible2() {
- objIAccessible2 = new COMObject(new int[] {2,0,0,/*IA>>*/1,3,5,8,1,1,2,2,2,2,2,2,2,3,2,1,1,2,2,5,3,3,1,2,2,/*<<IA*/1,2,3,1,1,3,3,1,1,1,1,3,3,1,1,1,1,1}) {
- @Override
- public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
- @Override
- public long /*int*/ method1(long /*int*/[] args) {return AddRef();}
- @Override
- public long /*int*/ method2(long /*int*/[] args) {return Release();}
-
- /*
- * Even though the IA2 spec says "AT's should not rely on IA inheritance",
- * some AT's do rely on it, so we need to implement the IAccessible methods here.
- */
- // method3 GetTypeInfoCount - not implemented
- // method4 GetTypeInfo - not implemented
- // method5 GetIDsOfNames - not implemented
- // method6 Invoke - not implemented
- @Override
- public long /*int*/ method7(long /*int*/[] args) {return get_accParent(args[0]);}
- @Override
- public long /*int*/ method8(long /*int*/[] args) {return get_accChildCount(args[0]);}
- @Override
- public long /*int*/ method9(long /*int*/[] args) {return get_accChild(args[0], args[1]);}
- @Override
- public long /*int*/ method10(long /*int*/[] args) {return get_accName(args[0], args[1]);}
- @Override
- public long /*int*/ method11(long /*int*/[] args) {return get_accValue(args[0], args[1]);}
- @Override
- public long /*int*/ method12(long /*int*/[] args) {return get_accDescription(args[0], args[1]);}
- @Override
- public long /*int*/ method13(long /*int*/[] args) {return get_accRole(args[0], args[1]);}
- @Override
- public long /*int*/ method14(long /*int*/[] args) {return get_accState(args[0], args[1]);}
- @Override
- public long /*int*/ method15(long /*int*/[] args) {return get_accHelp(args[0], args[1]);}
- @Override
- public long /*int*/ method16(long /*int*/[] args) {return get_accHelpTopic(args[0], args[1], args[2]);}
- @Override
- public long /*int*/ method17(long /*int*/[] args) {return get_accKeyboardShortcut(args[0], args[1]);}
- @Override
- public long /*int*/ method18(long /*int*/[] args) {return get_accFocus(args[0]);}
- @Override
- public long /*int*/ method19(long /*int*/[] args) {return get_accSelection(args[0]);}
- @Override
- public long /*int*/ method20(long /*int*/[] args) {return get_accDefaultAction(args[0], args[1]);}
- @Override
- public long /*int*/ method21(long /*int*/[] args) {return accSelect((int)/*64*/args[0], args[1]);}
- @Override
- public long /*int*/ method22(long /*int*/[] args) {return accLocation(args[0], args[1], args[2], args[3], args[4]);}
- @Override
- public long /*int*/ method23(long /*int*/[] args) {return accNavigate((int)/*64*/args[0], args[1], args[2]);}
- @Override
- public long /*int*/ method24(long /*int*/[] args) {return accHitTest((int)/*64*/args[0], (int)/*64*/args[1], args[2]);}
- @Override
- public long /*int*/ method25(long /*int*/[] args) {return accDoDefaultAction(args[0]);}
- @Override
- public long /*int*/ method26(long /*int*/[] args) {return put_accName(args[0], args[1]);}
- @Override
- public long /*int*/ method27(long /*int*/[] args) {return put_accValue(args[0], args[1]);}
// IAccessible2 methods
@Override
@@ -335,7 +246,7 @@ public class Accessible {
* then create a custom callback that dereferences the struct and
* passes a pointer to the original callback.
*/
- long /*int*/ ppVtable = objIAccessible2.ppVtable;
+ long /*int*/ ppVtable = objIAccessible.ppVtable;
long /*int*/[] pVtable = new long /*int*/[1];
OS.MoveMemory(pVtable, ppVtable, C.PTR_SIZEOF);
long /*int*/[] funcs = new long /*int*/[28];
@@ -359,29 +270,6 @@ public class Accessible {
OS.MoveMemory(pVtable[0], funcs, C.PTR_SIZEOF * funcs.length);
}
- void createIAccessibleAction() {
- objIAccessibleAction = new COMObject(new int[] {2,0,0,1,1,2,4,2,2}) {
- @Override
- public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
- @Override
- public long /*int*/ method1(long /*int*/[] args) {return AddRef();}
- @Override
- public long /*int*/ method2(long /*int*/[] args) {return Release();}
- @Override
- public long /*int*/ method3(long /*int*/[] args) {return get_nActions(args[0]);}
- @Override
- public long /*int*/ method4(long /*int*/[] args) {return doAction((int)/*64*/args[0]);}
- @Override
- public long /*int*/ method5(long /*int*/[] args) {return get_description((int)/*64*/args[0], args[1]);}
- @Override
- public long /*int*/ method6(long /*int*/[] args) {return get_keyBinding((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3]);}
- @Override
- public long /*int*/ method7(long /*int*/[] args) {return get_name((int)/*64*/args[0], args[1]);}
- @Override
- public long /*int*/ method8(long /*int*/[] args) {return get_localizedName((int)/*64*/args[0], args[1]);}
- };
- }
-
void createIAccessibleApplication() {
objIAccessibleApplication = new COMObject(new int[] {2,0,0,1,1,1,1}) {
@Override
@@ -622,55 +510,6 @@ public class Accessible {
};
}
- void createIAccessibleText() {
- objIAccessibleText = new COMObject(new int[] {2,0,0,2,4,1,6,1,4,3,3,5,5,5,1,1,3,1,3,5,1,1}) {
- @Override
- public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
- @Override
- public long /*int*/ method1(long /*int*/[] args) {return AddRef();}
- @Override
- public long /*int*/ method2(long /*int*/[] args) {return Release();}
- @Override
- public long /*int*/ method3(long /*int*/[] args) {return addSelection((int)/*64*/args[0], (int)/*64*/args[1]);}
- @Override
- public long /*int*/ method4(long /*int*/[] args) {return get_attributes((int)/*64*/args[0], args[1], args[2], args[3]);}
- @Override
- public long /*int*/ method5(long /*int*/[] args) {return get_caretOffset(args[0]);}
- @Override
- public long /*int*/ method6(long /*int*/[] args) {return get_characterExtents((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3], args[4], args[5]);}
- @Override
- public long /*int*/ method7(long /*int*/[] args) {return get_nSelections(args[0]);}
- @Override
- public long /*int*/ method8(long /*int*/[] args) {return get_offsetAtPoint((int)/*64*/args[0], (int)/*64*/args[1], (int)/*64*/args[2], args[3]);}
- @Override
- public long /*int*/ method9(long /*int*/[] args) {return get_selection((int)/*64*/args[0], args[1], args[2]);}
- @Override
- public long /*int*/ method10(long /*int*/[] args) {return get_text((int)/*64*/args[0], (int)/*64*/args[1], args[2]);}
- @Override
- public long /*int*/ method11(long /*int*/[] args) {return get_textBeforeOffset((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3], args[4]);}
- @Override
- public long /*int*/ method12(long /*int*/[] args) {return get_textAfterOffset((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3], args[4]);}
- @Override
- public long /*int*/ method13(long /*int*/[] args) {return get_textAtOffset((int)/*64*/args[0], (int)/*64*/args[1], args[2], args[3], args[4]);}
- @Override
- public long /*int*/ method14(long /*int*/[] args) {return removeSelection((int)/*64*/args[0]);}
- @Override
- public long /*int*/ method15(long /*int*/[] args) {return setCaretOffset((int)/*64*/args[0]);}
- @Override
- public long /*int*/ method16(long /*int*/[] args) {return setSelection((int)/*64*/args[0], (int)/*64*/args[1], (int)/*64*/args[2]);}
- @Override
- public long /*int*/ method17(long /*int*/[] args) {return get_nCharacters(args[0]);}
- @Override
- public long /*int*/ method18(long /*int*/[] args) {return scrollSubstringTo((int)/*64*/args[0], (int)/*64*/args[1], (int)/*64*/args[2]);}
- @Override
- public long /*int*/ method19(long /*int*/[] args) {return scrollSubstringToPoint((int)/*64*/args[0], (int)/*64*/args[1], (int)/*64*/args[2], (int)/*64*/args[3], (int)/*64*/args[4]);}
- @Override
- public long /*int*/ method20(long /*int*/[] args) {return get_newText(args[0]);}
- @Override
- public long /*int*/ method21(long /*int*/[] args) {return get_oldText(args[0]);}
- };
- }
-
void createIAccessibleValue() {
objIAccessibleValue = new COMObject(new int[] {2,0,0,1,1,1,1}) {
@Override
@@ -1805,14 +1644,7 @@ public class Accessible {
GUID guid = new GUID();
COM.MoveMemory(guid, iid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- OS.MoveMemory(ppvObject, new long /*int*/[] { getAddress() }, C.PTR_SIZEOF);
- AddRef();
- if (DEBUG) print(this + ".QueryInterface guid=" + guidString(guid) + " returning " + getAddress() + hresult(COM.S_OK));
- return COM.S_OK;
- }
-
- if (COM.IsEqualGUID(guid, COM.IIDIDispatch) || COM.IsEqualGUID(guid, COM.IIDIAccessible)) {
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDispatch) || COM.IsEqualGUID(guid, COM.IIDIAccessible)) {
if (objIAccessible == null) createIAccessible();
OS.MoveMemory(ppvObject, new long /*int*/[] { objIAccessible.getAddress() }, C.PTR_SIZEOF);
AddRef();
@@ -1930,14 +1762,6 @@ public class Accessible {
objIServiceProvider.dispose();
objIServiceProvider = null;
- if (objIAccessible2 != null)
- objIAccessible2.dispose();
- objIAccessible2 = null;
-
- if (objIAccessibleAction != null)
- objIAccessibleAction.dispose();
- objIAccessibleAction = null;
-
if (objIAccessibleApplication != null)
objIAccessibleApplication.dispose();
objIAccessibleApplication = null;
@@ -1972,10 +1796,6 @@ public class Accessible {
objIAccessibleTableCell.dispose();
objIAccessibleTableCell = null;
- if (objIAccessibleText != null)
- objIAccessibleText.dispose();
- objIAccessibleText = null;
-
if (objIAccessibleValue != null)
objIAccessibleValue.dispose();
objIAccessibleValue = null;
@@ -1997,7 +1817,7 @@ public class Accessible {
COM.MoveMemory(guid, riid, GUID.sizeof);
if (COM.IsEqualGUID(service, COM.IIDIAccessible)) {
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDispatch) | COM.IsEqualGUID(guid, COM.IIDIAccessible)) {
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDispatch) || COM.IsEqualGUID(guid, COM.IIDIAccessible)) {
if (objIAccessible == null) createIAccessible();
if (DEBUG) print(this + ".QueryService service=" + guidString(service) + " guid=" + guidString(guid) + " returning " + objIAccessible.getAddress() + hresult(COM.S_OK));
OS.MoveMemory(ppvObject, new long /*int*/[] { objIAccessible.getAddress() }, C.PTR_SIZEOF);
@@ -2045,8 +1865,9 @@ public class Accessible {
accessibleTableCellListenersSize() > 0 || accessibleTextExtendedListenersSize() > 0 ||
accessibleValueListenersSize() > 0 || accessibleControlListenersSize() > 0 || getRelationCount() > 0
|| (control instanceof Button && ((control.getStyle() & SWT.RADIO) != 0)) || (control instanceof Composite)) {
- if (objIAccessible2 == null) createIAccessible2();
- OS.MoveMemory(ppvObject, new long /*int*/[] { objIAccessible2.getAddress() }, C.PTR_SIZEOF);
+ // NOTE: IAccessible2 vtable is shared with IAccessible
+ if (objIAccessible == null) createIAccessible();
+ OS.MoveMemory(ppvObject, new long /*int*/[] { objIAccessible.getAddress() }, C.PTR_SIZEOF);
AddRef();
return COM.S_OK;
}
@@ -2055,8 +1876,9 @@ public class Accessible {
if (COM.IsEqualGUID(guid, COM.IIDIAccessibleAction)) {
if (accessibleActionListenersSize() > 0) {
- if (objIAccessibleAction == null) createIAccessibleAction();
- OS.MoveMemory(ppvObject, new long /*int*/[] { objIAccessibleAction.getAddress() }, C.PTR_SIZEOF);
+ // NOTE: IAccessibleAction vtable is shared with IAccessibleHyperlink
+ if (objIAccessibleHyperlink == null) createIAccessibleHyperlink();
+ OS.MoveMemory(ppvObject, new long /*int*/[] { objIAccessibleHyperlink.getAddress() }, C.PTR_SIZEOF);
AddRef();
return COM.S_OK;
}
@@ -2149,8 +1971,9 @@ public class Accessible {
if (COM.IsEqualGUID(guid, COM.IIDIAccessibleText)) {
if (accessibleTextExtendedListenersSize() > 0 || accessibleAttributeListenersSize() > 0) {
- if (objIAccessibleText == null) createIAccessibleText();
- OS.MoveMemory(ppvObject, new long /*int*/[] { objIAccessibleText.getAddress() }, C.PTR_SIZEOF);
+ // NOTE: IAccessibleText vtable is shared with IAccessibleHypertext
+ if (objIAccessibleHypertext == null) createIAccessibleHypertext();
+ OS.MoveMemory(ppvObject, new long /*int*/[] { objIAccessibleHypertext.getAddress() }, C.PTR_SIZEOF);
AddRef();
return COM.S_OK;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java
index a8366cd0d9..dce84b050b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java
@@ -19,7 +19,6 @@ import org.eclipse.swt.internal.win32.*;
final class OleEnumFORMATETC {
- private COMObject iUnknown;
private COMObject iEnumFORMATETC;
private int refCount;
@@ -37,15 +36,6 @@ int AddRef() {
return refCount;
}
private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[] {2, 0, 0}){
- @Override
- public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
- @Override
- public long /*int*/ method1(long /*int*/[] args) {return AddRef();}
- @Override
- public long /*int*/ method2(long /*int*/[] args) {return Release();}
- };
iEnumFORMATETC = new COMObject(new int[] {2, 0, 0, 3, 1, 0, 1}){
@Override
public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
@@ -63,11 +53,6 @@ private void createCOMInterfaces() {
};
}
private void disposeCOMInterfaces() {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
if (iEnumFORMATETC != null)
iEnumFORMATETC.dispose();
iEnumFORMATETC = null;
@@ -128,12 +113,7 @@ private int QueryInterface(long /*int*/ riid, long /*int*/ ppvObject) {
GUID guid = new GUID();
COM.MoveMemory(guid, riid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- OS.MoveMemory(ppvObject, new long /*int*/[] {iUnknown.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIEnumFORMATETC)) {
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIEnumFORMATETC)) {
OS.MoveMemory(ppvObject, new long /*int*/[] {iEnumFORMATETC.getAddress()}, C.PTR_SIZEOF);
AddRef();
return COM.S_OK;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
index 7bb333cc59..abcf1bd234 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java
@@ -50,7 +50,6 @@ import org.eclipse.swt.widgets.*;
public class OleClientSite extends Composite {
// Interfaces for this Ole Client Container
- private COMObject iUnknown;
COMObject iOleClientSite;
private COMObject iAdviseSink;
private COMObject iOleInPlaceSite;
@@ -503,15 +502,6 @@ private int ContextSensitiveHelp(int fEnterMode) {
}
protected void createCOMInterfaces() {
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- @Override
- public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
- @Override
- public long /*int*/ method1(long /*int*/[] args) {return AddRef();}
- @Override
- public long /*int*/ method2(long /*int*/[] args) {return Release();}
- };
-
iOleClientSite = new COMObject(new int[]{2, 0, 0, 0, 3, 1, 0, 1, 0}){
@Override
public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
@@ -620,12 +610,8 @@ private void deleteTempStorage() {
tempStorage = null;
}
protected void disposeCOMInterfaces() {
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
if (iOleClientSite != null)
- iOleClientSite.dispose();
+ iOleClientSite.dispose();
iOleClientSite = null;
if (iAdviseSink != null)
@@ -1092,8 +1078,8 @@ protected int QueryInterface(long /*int*/ riid, long /*int*/ ppvObject) {
GUID guid = new GUID();
COM.MoveMemory(guid, riid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- OS.MoveMemory(ppvObject, new long /*int*/[] {iUnknown.getAddress()}, C.PTR_SIZEOF);
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIOleClientSite)) {
+ OS.MoveMemory(ppvObject, new long /*int*/[] {iOleClientSite.getAddress()}, C.PTR_SIZEOF);
AddRef();
return COM.S_OK;
}
@@ -1102,11 +1088,6 @@ protected int QueryInterface(long /*int*/ riid, long /*int*/ ppvObject) {
AddRef();
return COM.S_OK;
}
- if (COM.IsEqualGUID(guid, COM.IIDIOleClientSite)) {
- OS.MoveMemory(ppvObject, new long /*int*/[] {iOleClientSite.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return COM.S_OK;
- }
if (COM.IsEqualGUID(guid, COM.IIDIOleInPlaceSite)) {
OS.MoveMemory(ppvObject, new long /*int*/[] {iOleInPlaceSite.getAddress()}, C.PTR_SIZEOF);
AddRef();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
index 5fd0d11a77..9b094970df 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
@@ -322,16 +322,6 @@ private int ContextSensitiveHelp(int fEnterMode) {
return COM.S_OK;
}
private void createCOMInterfaces() {
- // Create each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- @Override
- public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
- @Override
- public long /*int*/ method1(long /*int*/[] args) {return AddRef();}
- @Override
- public long /*int*/ method2(long /*int*/[] args) {return Release();}
- };
-
iOleInPlaceFrame = new COMObject(new int[]{2, 0, 0, 1, 1, 1, 1, 1, 2, 2, 3, 1, 1, 1, 2}){
@Override
public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
@@ -364,11 +354,6 @@ private void createCOMInterfaces() {
};
}
private void disposeCOMInterfaces () {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
if (iOleInPlaceFrame != null)
iOleInPlaceFrame.dispose();
iOleInPlaceFrame = null;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java
index e866b2660d..672f56e5f1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OlePropertyChangeSink.java
@@ -24,7 +24,6 @@ final class OlePropertyChangeSink {
private OleControlSite controlSite;
//private IUnknown objIUnknown;
- private COMObject iUnknown;
private COMObject iPropertyNotifySink;
private int refCount;
@@ -66,16 +65,6 @@ void connect(IUnknown objIUnknown) {
}
}
private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- @Override
- public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
- @Override
- public long /*int*/ method1(long /*int*/[] args) {return AddRef();}
- @Override
- public long /*int*/ method2(long /*int*/[] args) {return Release();}
- };
-
iPropertyNotifySink = new COMObject(new int[]{2, 0, 0, 1, 1}){
@Override
public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);}
@@ -108,8 +97,6 @@ void disconnect(IUnknown objIUnknown) {
}
}
private void disposeCOMInterfaces() {
- if (iUnknown != null) iUnknown.dispose();
- iUnknown = null;
if (iPropertyNotifySink != null) iPropertyNotifySink.dispose();
iPropertyNotifySink = null;
}
@@ -157,12 +144,7 @@ private int QueryInterface(long /*int*/ riid, long /*int*/ ppvObject) {
return COM.E_INVALIDARG;
GUID guid = new GUID();
COM.MoveMemory(guid, riid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- OS.MoveMemory(ppvObject, new long /*int*/[] {iUnknown.getAddress()}, C.PTR_SIZEOF);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIPropertyNotifySink)) {
+ if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIPropertyNotifySink)) {
OS.MoveMemory(ppvObject, new long /*int*/[] {iPropertyNotifySink.getAddress()}, C.PTR_SIZEOF);
AddRef();
return COM.S_OK;

Back to the top