diff options
author | Nikita Nemkin | 2020-01-22 09:13:14 +0000 |
---|---|---|
committer | Nikita Nemkin | 2020-01-25 13:59:05 +0000 |
commit | 552c841cdec57d1445d04f981fead6cc3fbd21c8 (patch) | |
tree | 478c387292557500d676f7c55b280b3f9d7aa8ab | |
parent | 6f075fa49f18eda277b49fd97bdcba8079b38a28 (diff) | |
download | eclipse.platform.swt-552c841cdec57d1445d04f981fead6cc3fbd21c8.tar.gz eclipse.platform.swt-552c841cdec57d1445d04f981fead6cc3fbd21c8.tar.xz eclipse.platform.swt-552c841cdec57d1445d04f981fead6cc3fbd21c8.zip |
Bug 559392 - Put ERROR_NO_MORE_CALLBACKS check into Callback constructor
It matches SWT convention better and saves many checks in client code.
Change-Id: I058cde090966befa564f9ba53b4a613928321f50
Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
40 files changed, 15 insertions, 183 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java index 7e8b9481d5..fe7bba7767 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/SWTAccessibleDelegate.java @@ -46,15 +46,12 @@ class SWTAccessibleDelegate extends NSObject { accessible2Args = new Callback(clazz, "accessibleProc", 2); proc2Args = accessible2Args.getAddress(); - if (proc2Args == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); accessible3Args = new Callback(clazz, "accessibleProc", 3); proc3Args = accessible3Args.getAddress(); - if (proc3Args == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); accessible4Args = new Callback(clazz, "accessibleProc", 4); proc4Args = accessible3Args.getAddress(); - if (proc4Args == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); // Accessible custom controls need to implement the NSAccessibility protocol. To do that, // we dynamically add the methods to the control's class that are required diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java index f539698c57..a52e27db0a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DragSource.java @@ -122,23 +122,18 @@ public class DragSource extends Widget { dragSource2Args = new Callback(clazz, "dragSourceProc", 2); proc2 = dragSource2Args.getAddress(); - if (proc2 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); dragSource3Args = new Callback(clazz, "dragSourceProc", 3); proc3 = dragSource3Args.getAddress(); - if (proc3 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); dragSource4Args = new Callback(clazz, "dragSourceProc", 4); proc4 = dragSource4Args.getAddress(); - if (proc4 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); dragSource5Args = new Callback(clazz, "dragSourceProc", 5); proc5 = dragSource5Args.getAddress(); - if (proc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); dragSource6Args = new Callback(clazz, "dragSourceProc", 6); proc6 = dragSource6Args.getAddress(); - if (proc6 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); long cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java index 486f942017..979e1e4f33 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java @@ -89,15 +89,12 @@ public class DropTarget extends Widget { dropTarget2Args = new Callback(clazz, "dropTargetProc", 2); proc2Args = dropTarget2Args.getAddress(); - if (proc2Args == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); dropTarget3Args = new Callback(clazz, "dropTargetProc", 3); proc3Args = dropTarget3Args.getAddress(); - if (proc3Args == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); dropTarget6Args = new Callback(clazz, "dropTargetProc", 6); proc6Args = dropTarget6Args.getAddress(); - if (proc6Args == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } static boolean dropNotAllowed = false; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java index 5181782bf9..3acc8f386c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ClipboardProxy.java @@ -54,9 +54,7 @@ static ClipboardProxy _getInstance(final Display display) { ClipboardProxy(Display display) { this.display = display; getFunc = new Callback( this, "getFunc", 4); //$NON-NLS-1$ - if (getFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); clearFunc = new Callback( this, "clearFunc", 2); //$NON-NLS-1$ - if (clearFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); } void clear (Clipboard owner, int clipboards) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java index dde5af62f0..e6e700b59e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java @@ -124,13 +124,9 @@ public class DragSource extends Widget { static Callback DragDataDelete; static { DragBegin = new Callback(DragSource.class, "DragBegin", 2); //$NON-NLS-1$ - if (DragBegin.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); DragGetData = new Callback(DragSource.class, "DragGetData", 5); //$NON-NLS-1$ - if (DragGetData.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); DragEnd = new Callback(DragSource.class, "DragEnd", 2); //$NON-NLS-1$ - if (DragEnd.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); DragDataDelete = new Callback(DragSource.class, "DragDataDelete", 2); //$NON-NLS-1$ - if (DragDataDelete.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java index 7daca526bd..531c36f494 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java @@ -111,13 +111,9 @@ public class DropTarget extends Widget { static { Drag_Motion = new Callback(DropTarget.class, "Drag_Motion", 5); //$NON-NLS-1$ - if (Drag_Motion.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); Drag_Leave = new Callback(DropTarget.class, "Drag_Leave", 3); //$NON-NLS-1$ - if (Drag_Leave.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); Drag_Data_Received = new Callback(DropTarget.class, "Drag_Data_Received", 7); //$NON-NLS-1$ - if (Drag_Data_Received.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); Drag_Drop = new Callback(DropTarget.class, "Drag_Drop", 5); //$NON-NLS-1$ - if (Drag_Drop.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java index e6a810af0e..58da0c6448 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/internal/ole/win32/COMObject.java @@ -15,7 +15,6 @@ package org.eclipse.swt.internal.ole.win32; import java.util.*; -import org.eclipse.swt.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.win32.*; @@ -34,7 +33,6 @@ public COMObject(int[] argCounts) { for (int i = 0, length = argCounts.length; i < length; i++){ if ((Callbacks[i][argCounts[i]]) == null) { Callbacks[i][argCounts[i]] = new Callback(this.getClass(), "callback"+i, argCounts[i] + 1, true, COM.E_FAIL); //$NON-NLS-1$ - if (Callbacks[i][argCounts[i]].getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); } callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress(); } 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 c320ba5198..cf172b5349 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 @@ -174,7 +174,6 @@ private static void initMsgHook(Display display) { if (display.getData(HHOOK) != null) return; final Callback callback = new Callback(OleFrame.class, "getMsgProc", 3); //$NON-NLS-1$ long address = callback.getAddress(); - if (address == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); int threadId = OS.GetCurrentThreadId(); final long hHook = OS.SetWindowsHookEx(OS.WH_GETMESSAGE, address, 0, threadId); if (hHook == 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java index ad2d5b424d..0ee5b440e6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/cocoa/org/eclipse/swt/printing/PrintDialog.java @@ -290,7 +290,6 @@ void initClasses () { dialogCallback5 = new Callback(getClass(), "dialogProc", 5); long dialogProc5 = dialogCallback5.getAddress(); - if (dialogProc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); byte[] types = {'*','\0'}; int size = C.PTR_SIZEOF, align = C.PTR_SIZEOF == 4 ? 2 : 3; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java index e434b5d829..4204106bf6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java @@ -467,7 +467,6 @@ public PrinterData open() { /* Save other print_settings data as key/value pairs in otherData. */ Callback printSettingsCallback = new Callback(this, "GtkPrintSettingsFunc", 3); //$NON-NLS-1$ long GtkPrintSettingsFunc = printSettingsCallback.getAddress(); - if (GtkPrintSettingsFunc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); index = 0; settingsData = new byte[1024]; GTK.gtk_print_settings_foreach (settings, GtkPrintSettingsFunc, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java index 4062e2d0a6..7824b6659c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java @@ -88,9 +88,7 @@ public static PrinterData[] getPrinterList() { } gtk_init(); Callback printerCallback = new Callback(Printer.class, "GtkPrinterFunc_List", 2); //$NON-NLS-1$ - long GtkPrinterFunc_List = printerCallback.getAddress(); - if (GtkPrinterFunc_List == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - GTK.gtk_enumerate_printers(GtkPrinterFunc_List, 0, 0, true); + GTK.gtk_enumerate_printers(printerCallback.getAddress(), 0, 0, true); /* * This call to gdk_threads_leave() is a temporary work around * to avoid deadlocks when gdk_threads_init() is called by native @@ -136,9 +134,7 @@ public static PrinterData getDefaultPrinterData() { } gtk_init(); Callback printerCallback = new Callback(Printer.class, "GtkPrinterFunc_Default", 2); //$NON-NLS-1$ - long GtkPrinterFunc_Default = printerCallback.getAddress(); - if (GtkPrinterFunc_Default == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - GTK.gtk_enumerate_printers(GtkPrinterFunc_Default, 0, 0, true); + GTK.gtk_enumerate_printers(printerCallback.getAddress(), 0, 0, true); /* * This call to gdk_threads_leave() is a temporary work around * to avoid deadlocks when gdk_threads_init() is called by native @@ -161,11 +157,9 @@ static long GtkPrinterFunc_Default (long printer, long user_data) { static long gtkPrinterFromPrinterData(PrinterData data) { gtk_init(); Callback printerCallback = new Callback(Printer.class, "GtkPrinterFunc_FindNamedPrinter", 2); //$NON-NLS-1$ - long GtkPrinterFunc_FindNamedPrinter = printerCallback.getAddress(); - if (GtkPrinterFunc_FindNamedPrinter == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); findPrinter = 0; findData = data; - GTK.gtk_enumerate_printers(GtkPrinterFunc_FindNamedPrinter, 0, 0, true); + GTK.gtk_enumerate_printers(printerCallback.getAddress(), 0, 0, true); /* * This call to gdk_threads_leave() is a temporary work around * to avoid deadlocks when gdk_threads_init() is called by native diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java index 49f9a19ebd..3ad4a5091d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java @@ -124,21 +124,15 @@ public void create (Composite parent, int style) { Class webKitClass = this.getClass(); Callback3 = new Callback(webKitClass, "browserProc", 3); //$NON-NLS-1$ long proc3 = Callback3.getAddress(); - if (proc3 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); Callback4 = new Callback(webKitClass, "browserProc", 4); //$NON-NLS-1$ long proc4 = Callback4.getAddress(); - if (proc4 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); Callback5 = new Callback(webKitClass, "browserProc", 5); //$NON-NLS-1$ long proc5 = Callback5.getAddress(); - if (proc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); Callback6 = new Callback(webKitClass, "browserProc", 6); //$NON-NLS-1$ long proc6 = Callback6.getAddress(); - if (proc6 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); Callback7 = new Callback(webKitClass, "browserProc", 7); //$NON-NLS-1$ long proc7 = Callback7.getAddress(); - if (proc7 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); long setFrameProc = OS.CALLBACK_webView_setFrame_(proc4); - if (setFrameProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); String className = "SWTWebViewDelegate"; //$NON-NLS-1$ byte[] types = {'*','\0'}; diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java index c9a363a280..6271e9ced7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java @@ -208,20 +208,14 @@ class WebKit extends WebBrowser { static { Proc2 = new Callback (WebKit.class, "Proc", 2); //$NON-NLS-1$ - if (Proc2.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); Proc3 = new Callback (WebKit.class, "Proc", 3); //$NON-NLS-1$ - if (Proc3.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); Proc4 = new Callback (WebKit.class, "Proc", 4); //$NON-NLS-1$ - if (Proc4.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); Proc5 = new Callback (WebKit.class, "Proc", 5); //$NON-NLS-1$ - if (Proc5.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - new Webkit2AsyncToSync(); WebKitExtension.init(); JSDOMEventProc = new Callback (WebKit.class, "JSDOMEventProc", 3); //$NON-NLS-1$ - if (JSDOMEventProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); NativeClearSessions = () -> { if (!WebKitGTK.LibraryLoaded) return; @@ -377,7 +371,6 @@ class WebKit extends WebBrowser { System.err.println("SWT WebKit: error initializing DBus server, dBusServer == 0"); } initializeWebExtensions_callback = new Callback(WebKitExtension.class, "initializeWebExtensions_callback", void.class, new Type [] {long.class, long.class}); - if (initializeWebExtensions_callback.getAddress() == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); if (WebKitGTK.webkit_get_minor_version() >= 4) { // Callback exists only since 2.04 OS.g_signal_connect (WebKitGTK.webkit_web_context_get_default(), WebKitGTK.initialize_web_extensions, initializeWebExtensions_callback.getAddress(), 0); } @@ -1052,16 +1045,9 @@ private static class Webkit2AsyncToSync { static { runjavascript_callback = new Callback(Webkit2AsyncToSync.class, "runjavascript_callback", void.class, new Type[] {long.class, long.class, long.class}); - if (runjavascript_callback.getAddress() == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - getText_callback = new Callback(Webkit2AsyncToSync.class, "getText_callback", void.class, new Type[] {long.class, long.class, long.class}); - if (getText_callback.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); - setCookie_callback = new Callback(Webkit2AsyncToSync.class, "setCookie_callback", void.class, new Type[] {long.class, long.class, long.class}); - if (setCookie_callback.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); - getCookie_callback = new Callback(Webkit2AsyncToSync.class, "getCookie_callback", void.class, new Type[] {long.class, long.class, long.class}); - if (getCookie_callback.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); } /** Object used to return data from callback to original call */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java index 8291e9f57b..0387780a28 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java @@ -158,19 +158,10 @@ class WebkitGDBus { static { handleMethodCB = new Callback (WebkitGDBus.class, "handleMethodCB", 8); //$NON-NLS-1$ - if (handleMethodCB.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - callExtensionAsyncCB = new Callback (WebkitGDBus.class, "callExtensionAsyncCB", 3); //$NON-NLS-1$ - if (callExtensionAsyncCB.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - newConnectionCB = new Callback (WebkitGDBus.class, "newConnectionCB", 3); //$NON-NLS-1$ - if (newConnectionCB.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - newConnectionToExtensionCB = new Callback (WebkitGDBus.class, "newConnectionToExtensionCB", 3); //$NON-NLS-1$ - if (newConnectionToExtensionCB.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - authenticatePeerCB = new Callback (WebkitGDBus.class, "authenticatePeerCB", 4); //$NON-NLS-1$ - if (authenticatePeerCB.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } /** True iff the GDBusServer has been initialized */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java index 9b28809d06..babaf09dea 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java @@ -140,11 +140,8 @@ static { if (LibraryLoaded) { JSObjectHasPropertyProc = new Callback (WebKit.class, "JSObjectHasPropertyProc", 3); //$NON-NLS-1$ - if (JSObjectHasPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); JSObjectGetPropertyProc = new Callback (WebKit.class, "JSObjectGetPropertyProc", 4); //$NON-NLS-1$ - if (JSObjectGetPropertyProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); JSObjectCallAsFunctionProc = new Callback (WebKit.class, "JSObjectCallAsFunctionProc", 6); //$NON-NLS-1$ - if (JSObjectCallAsFunctionProc.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); NativeClearSessions = () -> { long[] result = new long[1]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java index 453e5da3e0..7b667be5c9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java @@ -911,7 +911,6 @@ NSAttributedString createString(String string, int flags, boolean draw) { NSBezierPath createNSBezierPath (long cgPath) { Callback callback = new Callback(this, "applierFunc", 2); long proc = callback.getAddress(); - if (proc == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); count = typeCount = 0; element = new CGPathElement(); OS.CGPathApply(cgPath, 0, proc); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java index b4b30d3ab6..304368ed91 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Region.java @@ -368,10 +368,8 @@ NSAffineTransform transform; void convertRgn(NSAffineTransform transform) { long newRgn = OS.NewRgn(); Callback callback = new Callback(this, "convertRgn", 4); - long proc = callback.getAddress(); - if (proc == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); this.transform = transform; - OS.QDRegionToRects(handle, OS.kQDParseRegionFromTopLeft, proc, newRgn); + OS.QDRegionToRects(handle, OS.kQDParseRegionFromTopLeft, callback.getAddress(), newRgn); this.transform = null; callback.dispose(); OS.CopyRgn(newRgn, handle); @@ -469,7 +467,6 @@ public Rectangle getBounds() { NSBezierPath getPath() { Callback callback = new Callback(this, "regionToRects", 4); - if (callback.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); NSBezierPath path = NSBezierPath.bezierPath(); path.retain(); OS.QDRegionToRects(handle, OS.kQDParseRegionFromTopLeft, callback.getAddress(), path.id); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java index c681055135..2d004432bc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java @@ -1624,7 +1624,6 @@ void initClasses () { textLayoutCallback2 = new Callback(getClass(), "textLayoutProc", 2); long proc2 = textLayoutCallback2.getAddress(); - if (proc2 == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); long cellBaselineOffsetProc = OS.CALLBACK_cellBaselineOffset(proc2); long cellSizeProc = OS.CALLBACK_NSTextAttachmentCell_cellSize(proc2); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java index 732d6d9df1..cbe0ad8d07 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java @@ -1899,7 +1899,6 @@ NSBezierPath getPath(Region region) { NSBezierPath getPath(long region) { Callback callback = new Callback(this, "regionToRects", 4); - if (callback.getAddress() == 0) error(SWT.ERROR_NO_MORE_CALLBACKS); NSBezierPath path = NSBezierPath.bezierPath(); path.retain(); OS.QDRegionToRects(region, OS.kQDParseRegionFromTopLeft, callback.getAddress(), path.id); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java index 0c8b748b5f..35d9deb723 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/DirectoryDialog.java @@ -171,7 +171,6 @@ public String open () { if (parent != null && (style & SWT.SHEET) != 0) { completion_handler_callback = new Callback(this, "_completionHandler", 1); long handler = completion_handler_callback.getAddress(); - if (handler == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); OS.beginSheetModalForWindow(panel, parent.view.window(), handler); NSApplication.sharedApplication().runModalForWindow(parent.view.window()); } else { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index e5a8604ff3..20f5088cbb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -899,16 +899,11 @@ void createDisplay (DeviceData data) { Class clazz = getClass(); applicationCallback2 = new Callback(clazz, "applicationProc", 2); long proc2 = applicationCallback2.getAddress(); - if (proc2 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); applicationCallback3 = new Callback(clazz, "applicationProc", 3); long proc3 = applicationCallback3.getAddress(); - if (proc3 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); applicationCallback4 = new Callback(clazz, "applicationProc", 4); - long proc4 = applicationCallback4.getAddress(); - if (proc4 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); applicationCallback6 = new Callback(clazz, "applicationProc", 6); long proc6 = applicationCallback6.getAddress(); - if (proc6 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); long superClassID = OS.object_getClass(application.id); if (new NSObject(superClassID).className().getString().equals("NSKVONotifying_NSApplication")) { /* @@ -935,9 +930,7 @@ void createDisplay (DeviceData data) { className = "SWTApplicationDelegate"; if (OS.objc_lookUpClass (className) == 0) { long appProc3 = applicationCallback3.getAddress(); - if (appProc3 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); long appProc4 = applicationCallback4.getAddress(); - if (appProc4 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); OS.class_addMethod(cls, OS.sel_applicationWillFinishLaunching_, appProc3, "@:@"); OS.class_addMethod(cls, OS.sel_terminate_, appProc3, "@:@"); @@ -2318,7 +2311,6 @@ protected void init () { observerCallback = new Callback (this, "observerProc", 3); //$NON-NLS-1$ long observerProc = observerCallback.getAddress (); - if (observerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); int activities = OS.kCFRunLoopBeforeWaiting; runLoopObserver = OS.CFRunLoopObserverCreate (0, activities, true, 0, observerProc, 0); if (runLoopObserver == 0) error (SWT.ERROR_NO_HANDLES); @@ -2335,7 +2327,6 @@ protected void init () { cursorSetCallback = new Callback(this, "cursorSetProc", 2); long cursorSetProc = cursorSetCallback.getAddress(); - if (cursorSetProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); long method = OS.class_getInstanceMethod(OS.class_NSCursor, OS.sel_set); if (method != 0) oldCursorSetProc = OS.method_setImplementation(method, cursorSetProc); @@ -2504,28 +2495,20 @@ void initClasses () { Class clazz = getClass (); dialogCallback3 = new Callback(clazz, "dialogProc", 3); long dialogProc3 = dialogCallback3.getAddress(); - if (dialogProc3 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); dialogCallback4 = new Callback(clazz, "dialogProc", 4); long dialogProc4 = dialogCallback4.getAddress(); - if (dialogProc4 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); dialogCallback5 = new Callback(clazz, "dialogProc", 5); long dialogProc5 = dialogCallback5.getAddress(); - if (dialogProc5 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); windowCallback3 = new Callback(clazz, "windowProc", 3); long proc3 = windowCallback3.getAddress(); - if (proc3 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); windowCallback2 = new Callback(clazz, "windowProc", 2); long proc2 = windowCallback2.getAddress(); - if (proc2 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); windowCallback4 = new Callback(clazz, "windowProc", 4); long proc4 = windowCallback4.getAddress(); - if (proc4 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); windowCallback5 = new Callback(clazz, "windowProc", 5); long proc5 = windowCallback5.getAddress(); - if (proc5 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); windowCallback6 = new Callback(clazz, "windowProc", 6); long proc6 = windowCallback6.getAddress(); - if (proc6 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); long isFlippedProc = OS.isFlipped_CALLBACK(); long drawRectProc = OS.CALLBACK_drawRect_(proc3); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java index aa26a4bbb1..d1ab69d018 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FileDialog.java @@ -344,7 +344,6 @@ public String open () { if (!overwrite) { callback_overwrite_existing_file = new Callback(this, "_overwriteExistingFileCheck", 3); long proc = callback_overwrite_existing_file.getAddress(); - if (proc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); method = OS.class_getInstanceMethod(OS.class_NSSavePanel, OS.sel_overwriteExistingFileCheck); if (method != 0) methodImpl = OS.method_setImplementation(method, proc); } @@ -411,7 +410,6 @@ public String open () { if (parent != null && (style & SWT.SHEET) != 0) { callback_completion_handler = new Callback(this, "_completionHandler", 1); long handler = callback_completion_handler.getAddress(); - if (handler == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); OS.beginSheetModalForWindow(panel, parent.view.window(), handler); NSApplication.sharedApplication().runModalForWindow(parent.view.window()); } else { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java index 2248861bae..61caae3c69 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java @@ -135,6 +135,7 @@ public Callback (Object object, String method, int argCount, boolean isArrayBase /* Bind the address */ address = bind (this, object, method, signature, argCount, isStatic, isArrayBased, errorResult); + if (address == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } @@ -230,10 +231,9 @@ public Callback (Object object, String method, Type returnType, Type [] argument /* Bind the address */ address = bind (this, this.object, this.method, this.signature, this.argCount, this.isStatic, this.isArrayBased, this.errorResult); + if (address == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } - - /** * Allocates the native level resources associated with the * callback. This method is only invoked from within the diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java index 463a5ec577..aa68ff9105 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java @@ -592,10 +592,8 @@ protected void init () { if (index == Devices.length) { XErrorCallback = new Callback (clazz, "XErrorProc", 2); XNullErrorProc = XErrorCallback.getAddress (); - if (XNullErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); XIOErrorCallback = new Callback (clazz, "XIOErrorProc", 1); XNullIOErrorProc = XIOErrorCallback.getAddress (); - if (XNullIOErrorProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); XErrorProc = OS.XSetErrorHandler (XNullErrorProc); XIOErrorProc = OS.XSetIOErrorHandler (XNullIOErrorProc); } @@ -608,7 +606,6 @@ protected void init () { if (xDisplay != 0) { logCallback = new Callback (this, "logProc", 4); logProc = logCallback.getAddress (); - if (logProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); /* Set GTK warning and error handlers */ if (debug) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/GDBus.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/GDBus.java index 3d0c378eab..2e3b3d62f0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/GDBus.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/GDBus.java @@ -175,16 +175,9 @@ public class GDBus { static { onBusAcquired = new Callback (GDBus.class, "onBusAcquired", 3); //$NON-NLS-1$ - if (onBusAcquired.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - onNameAcquired = new Callback (GDBus.class, "onNameAcquired", 3); //$NON-NLS-1$ - if (onNameAcquired.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - onNameLost = new Callback (GDBus.class, "onNameLost", 3); //$NON-NLS-1$ - if (onNameLost.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - handleMethod = new Callback (GDBus.class, "handleMethod", 8); //$NON-NLS-1$ - if (handleMethod.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); String swt_lib_versions = OS.getEnvironmentalVariable (OS.SWT_LIB_VERSIONS); // Note, this is read in multiple places. if (swt_lib_versions != null && swt_lib_versions.equals("1")) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java index 98c57ee23d..06b62d2bd7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java @@ -92,19 +92,14 @@ public abstract class Control extends Widget implements Drawable { static { gestureZoom = new Callback (Control.class, "magnifyProc", void.class, new Type[] { long.class, double.class, long.class}); //$NON-NLS-1$ - if (gestureZoom.getAddress() == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); gestureRotation = new Callback (Control.class, "rotateProc", void.class, new Type[] { long.class, double.class, double.class, long.class}); //$NON-NLS-1$ - if (gestureRotation.getAddress() == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); gestureSwipe = new Callback (Control.class, "swipeProc", void.class, new Type[] { long.class, double.class, double.class, long.class}); //$NON-NLS-1$ - if (gestureSwipe.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); gestureBegin = new Callback (Control.class, "gestureBeginProc", void.class, new Type[] { long.class, long.class, long.class}); //$NON-NLS-1$ - if (gestureBegin.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); gestureEnd = new Callback (Control.class, "gestureEndProc", void.class, new Type[] { long.class, long.class, long.class}); //$NON-NLS-1$ - if (gestureEnd.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); } /** * Bug 541635, 515396: GTK Wayland only flag to keep track whether mouse diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java index 31e6b79ba2..7c5944de9c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java @@ -1150,25 +1150,21 @@ void createDisplay (DeviceData data) { if (rendererClassInitProc == 0) { rendererClassInitCallback = new Callback (getClass (), "rendererClassInitProc", 2); //$NON-NLS-1$ rendererClassInitProc = rendererClassInitCallback.getAddress (); - if (rendererClassInitProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); } if (GTK.GTK4) { if (rendererSnapshotProc == 0) { rendererSnapshotCallback = new Callback (getClass (), "rendererSnapshotProc", 6); //$NON-NLS-1$ rendererSnapshotProc = rendererSnapshotCallback.getAddress (); - if (rendererSnapshotProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); } } else { if (rendererRenderProc == 0) { rendererRenderCallback = new Callback (getClass (), "rendererRenderProc", 6); //$NON-NLS-1$ rendererRenderProc = rendererRenderCallback.getAddress (); - if (rendererRenderProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); } } if (rendererGetPreferredWidthProc == 0) { rendererGetPreferredWidthCallback = new Callback (getClass (), "rendererGetPreferredWidthProc", 4); //$NON-NLS-1$ rendererGetPreferredWidthProc = rendererGetPreferredWidthCallback.getAddress (); - if (rendererGetPreferredWidthProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); } if (text_renderer_type == 0) { GTypeInfo renderer_info = new GTypeInfo (); @@ -1216,12 +1212,10 @@ void createDisplay (DeviceData data) { /* Initialize the filter and event callback */ eventCallback = new Callback (this, "eventProc", 2); //$NON-NLS-1$ eventProc = eventCallback.getAddress (); - if (eventProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); GDK.gdk_event_handler_set (eventProc, 0, 0); signalCallback = new Callback (this, "signalProc", 3); //$NON-NLS-1$ signalProc = signalCallback.getAddress (); - if (signalProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); if (!GTK.GTK4) { byte[] atomName = Converter.wcsToMbcs ("SWT_Window_" + APP_NAME, true); //$NON-NLS-1$ @@ -1237,7 +1231,6 @@ void createDisplay (DeviceData data) { latinKeyGroup = findLatinKeyGroup (); keysChangedCallback = new Callback (this, "keysChangedProc", 2); //$NON-NLS-1$ keysChangedProc = keysChangedCallback.getAddress (); - if (keysChangedProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); long keymap; long display = GDK.gdk_display_get_default(); if (GTK.GTK4) { @@ -3421,18 +3414,15 @@ void initializeCallbacks () { if (GTK.GTK4) { snapshotDraw = new Callback (getClass (), "snapshotDrawProc", 2); //$NON-NLS-1$ snapshotDrawProc = snapshotDraw.getAddress (); - if (snapshotDrawProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); } windowCallback2 = new Callback (this, "windowProc", 2); //$NON-NLS-1$ windowProc2 = windowCallback2.getAddress (); - if (windowProc2 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); if (GTK.GTK4) { keyPressReleaseCallback = new Callback (this, "keyPressReleaseProc", long.class, new Type[] { long.class, int.class, int.class, int.class, long.class}); //$NON-NLS-1$ keyPressReleaseProc = keyPressReleaseCallback.getAddress (); - if (keyPressReleaseProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); /* * Usually GTK4 signals will be connected via g_signal_connect(), @@ -3445,7 +3435,6 @@ void initializeCallbacks () { focusCallback = new Callback (this, "focusProc", long.class, new Type[] { long.class, long.class}); //$NON-NLS-1$ focusProc = focusCallback.getAddress (); - if (focusProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.FOCUS_IN] = focusProc; closuresProc [Widget.FOCUS_OUT] = focusProc; @@ -3453,7 +3442,6 @@ void initializeCallbacks () { enterMotionScrollCallback = new Callback (this, "enterMotionScrollProc", long.class, new Type[] { long.class, double.class, double.class, long.class}); //$NON-NLS-1$ enterMotionScrollProc = enterMotionScrollCallback.getAddress (); - if (enterMotionScrollProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.ENTER] = enterMotionScrollProc; closuresProc [Widget.MOTION] = enterMotionScrollProc; @@ -3462,7 +3450,6 @@ void initializeCallbacks () { gesturePressReleaseCallback = new Callback (this, "gesturePressReleaseProc", long.class, new Type[] { long.class, int.class, double.class, double.class, long.class}); //$NON-NLS-1$ gesturePressReleaseProc = gesturePressReleaseCallback.getAddress(); - if (gesturePressReleaseProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.GESTURE_PRESSED] = gesturePressReleaseProc; closuresProc [Widget.GESTURE_RELEASED] = gesturePressReleaseProc; @@ -3470,7 +3457,6 @@ void initializeCallbacks () { leaveCallback = new Callback (this, "leaveProc", long.class, new Type[] { long.class, long.class}); //$NON-NLS-1$ leaveProc = leaveCallback.getAddress (); - if (leaveProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.LEAVE] = leaveProc; } @@ -3478,7 +3464,6 @@ void initializeCallbacks () { notifyCallback = new Callback(this, "notifyProc", long.class, new Type[] { long.class, long.class, long.class}); //$NON-NLS-1$ notifyProc = notifyCallback.getAddress(); - if (notifyProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.NOTIFY_STATE] = notifyProc; closuresProc [Widget.DPI_CHANGED] = notifyProc; @@ -3518,7 +3503,6 @@ void initializeCallbacks () { windowCallback3 = new Callback (this, "windowProc", 3); //$NON-NLS-1$ windowProc3 = windowCallback3.getAddress (); - if (windowProc3 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.BUTTON_PRESS_EVENT] = windowProc3; closuresProc [Widget.BUTTON_PRESS_EVENT_INVERSE] = windowProc3; @@ -3556,7 +3540,6 @@ void initializeCallbacks () { windowCallback4 = new Callback (this, "windowProc", 4); //$NON-NLS-1$ windowProc4 = windowCallback4.getAddress (); - if (windowProc4 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.DELETE_RANGE] = windowProc4; closuresProc [Widget.DELETE_TEXT] = windowProc4; @@ -3575,7 +3558,6 @@ void initializeCallbacks () { windowCallback5 = new Callback (this, "windowProc", 5); //$NON-NLS-1$ windowProc5 = windowCallback5.getAddress (); - if (windowProc5 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); /* * The "change-value" signal has a double parameter, so this @@ -3583,7 +3565,6 @@ void initializeCallbacks () { */ changeValue = new Callback (this, "changeValue", boolean.class, new Type [] {long.class, int.class, double.class, long.class}); //$NON-NLS-1$ changeValueProc = changeValue.getAddress (); - if (changeValueProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.CHANGE_VALUE] = changeValueProc; closuresProc [Widget.EXPAND_COLLAPSE_CURSOR_ROW] = windowProc5; @@ -3595,7 +3576,6 @@ void initializeCallbacks () { if (signalIds [Widget.POPPED_UP] != 0) { windowCallback6 = new Callback (this, "windowProc", 6); //$NON-NLS-1$ windowProc6 = windowCallback6.getAddress (); - if (windowProc6 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); closuresProc [Widget.POPPED_UP] = windowProc6; } @@ -3611,58 +3591,45 @@ void initializeCallbacks () { timerCallback = new Callback (this, "timerProc", 1); //$NON-NLS-1$ timerProc = timerCallback.getAddress (); - if (timerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); windowTimerCallback = new Callback (this, "windowTimerProc", 1); //$NON-NLS-1$ windowTimerProc = windowTimerCallback.getAddress (); - if (windowTimerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); mouseHoverCallback = new Callback (this, "mouseHoverProc", 1); //$NON-NLS-1$ mouseHoverProc = mouseHoverCallback.getAddress (); - if (mouseHoverProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); caretCallback = new Callback(this, "caretProc", 1); //$NON-NLS-1$ caretProc = caretCallback.getAddress(); - if (caretProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); sizeAllocateCallback = new Callback(this, "sizeAllocateProc", 3); //$NON-NLS-1$ sizeAllocateProc = sizeAllocateCallback.getAddress(); - if (sizeAllocateProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); sizeRequestCallback = new Callback(this, "sizeRequestProc", 3); //$NON-NLS-1$ sizeRequestProc = sizeRequestCallback.getAddress(); - if (sizeRequestProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); shellMapCallback = new Callback(this, "shellMapProc", 3); //$NON-NLS-1$ shellMapProc = shellMapCallback.getAddress(); - if (shellMapProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); shellMapProcClosure = OS.g_cclosure_new (shellMapProc, 0, 0); OS.g_closure_ref (shellMapProcClosure); cellDataCallback = new Callback (this, "cellDataProc", 5); //$NON-NLS-1$ cellDataProc = cellDataCallback.getAddress (); - if (cellDataProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); setDirectionCallback = new Callback (this, "setDirectionProc", 2); //$NON-NLS-1$ setDirectionProc = setDirectionCallback.getAddress (); - if (setDirectionProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); emissionProcCallback = new Callback (this, "emissionProc", 4); //$NON-NLS-1$ emissionProc = emissionProcCallback.getAddress (); - if (emissionProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); allChildrenCallback = new Callback (this, "allChildrenProc", 2); //$NON-NLS-1$ allChildrenProc = allChildrenCallback.getAddress (); - if (allChildrenProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); checkIfEventCallback = new Callback (this, "checkIfEventProc", 3); //$NON-NLS-1$ checkIfEventProc = checkIfEventCallback.getAddress (); - if (checkIfEventProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); idleCallback = new Callback (this, "idleProc", 1); //$NON-NLS-1$ idleProc = idleCallback.getAddress (); - if (idleProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); } void initializeNamedColorList() { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index 143fedda87..2f126959e5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -52,11 +52,7 @@ public class ToolBar extends Composite { ToolItem [] tabItemList; ImageList imageList; boolean hasChildFocus; - static Callback menuItemSelectedFunc; - static { - menuItemSelectedFunc = new Callback(ToolBar.class, "MenuItemSelectedProc", 2); - if (menuItemSelectedFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); - } + static Callback menuItemSelectedFunc = new Callback(ToolBar.class, "MenuItemSelectedProc", 2); String cssBackground, cssForeground = " "; /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java index 51f0a779bc..4e38e1f7a7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java @@ -2058,9 +2058,7 @@ int gdk_pointer_grab (long gdkResource, int grab_ownership, boolean owner_events if (gdkSeatGrabPrepareFunc == null) { gdkSeatGrabPrepareFunc = new Callback(Widget.class, "GdkSeatGrabPrepareFunc", 3); //$NON-NLS-1$ } - long gdkSeatGrabPrepareFuncAddress = gdkSeatGrabPrepareFunc.getAddress(); - if (gdkSeatGrabPrepareFuncAddress == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); - return GDK.gdk_seat_grab(seat, gdkResource, GDK.GDK_SEAT_CAPABILITY_ALL_POINTING, owner_events, cursor, 0, gdkSeatGrabPrepareFuncAddress, gdkResource); + return GDK.gdk_seat_grab(seat, gdkResource, GDK.GDK_SEAT_CAPABILITY_ALL_POINTING, owner_events, cursor, 0, gdkSeatGrabPrepareFunc.getAddress(), gdkResource); } else { long pointer = GDK.gdk_get_pointer(display); return GDK.gdk_device_grab (pointer, gdkResource, grab_ownership, owner_events, event_mask, cursor, time_); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java index d809be5286..b9b7a31aae 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java @@ -487,7 +487,6 @@ public FontData [] getFontList (String faceName, boolean scalable) { /* Create the callback */ Callback callback = new Callback (this, "EnumFontFamProc", 4); //$NON-NLS-1$ long lpEnumFontFamProc = callback.getAddress (); - if (lpEnumFontFamProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); /* Initialize the instance variables */ metrics = new TEXTMETRIC (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java index f1b8c5210b..247842e13d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java @@ -14,9 +14,9 @@ package org.eclipse.swt.graphics; +import org.eclipse.swt.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.win32.*; -import org.eclipse.swt.*; /** * Instances of this class describe operating system fonts. @@ -521,9 +521,7 @@ public void setLocale(String locale) { data.lfCharSet = (byte)OS.DEFAULT_CHARSET; } else { Callback callback = new Callback (this, "EnumLocalesProc", 1); //$NON-NLS-1$ - long lpEnumLocalesProc = callback.getAddress (); - if (lpEnumLocalesProc == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); - OS.EnumSystemLocales(lpEnumLocalesProc, OS.LCID_SUPPORTED); + OS.EnumSystemLocales(callback.getAddress (), OS.LCID_SUPPORTED); callback.dispose (); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index 662d128133..2a211e340f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -3543,9 +3543,7 @@ void shape (final long hdc, final StyleItem run) { boolean compilerWarningWorkaround = false; if (compilerWarningWorkaround) object.metaFileEnumProc(0, 0, 0, 0, 0); Callback callback = new Callback(object, "metaFileEnumProc", 5); - long address = callback.getAddress(); - if (address == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); - OS.EnumEnhMetaFile(0, metaFile, address, 0, null); + OS.EnumEnhMetaFile(0, metaFile, callback.getAddress(), 0, null); OS.DeleteEnhMetaFile(metaFile); callback.dispose(); newFont = OS.CreateFontIndirect(emr.elfw.elfLogFont); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java index 3a09ed7929..e673953d1b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java @@ -55,7 +55,6 @@ public class BidiUtil { static { try { callback = new Callback (Class.forName (CLASS_NAME), "windowProc", 4); //$NON-NLS-1$ - if (callback.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } catch (ClassNotFoundException e) {} } @@ -443,9 +442,7 @@ public static boolean isBidiPlatform() { Callback callback = null; try { callback = new Callback (Class.forName (CLASS_NAME), "EnumSystemLanguageGroupsProc", 5); //$NON-NLS-1$ - long lpEnumSystemLanguageGroupsProc = callback.getAddress (); - if (lpEnumSystemLanguageGroupsProc == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); - OS.EnumSystemLanguageGroups(lpEnumSystemLanguageGroupsProc, OS.LGRPID_INSTALLED, 0); + OS.EnumSystemLanguageGroups(callback.getAddress (), OS.LGRPID_INSTALLED, 0); callback.dispose (); } catch (ClassNotFoundException e) { //callback can only be null at this point diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java index 9f9072e04e..e710020139 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java @@ -202,7 +202,6 @@ public RGB open () { /* Create the CCHookProc */ Callback callback = new Callback (this, "CCHookProc", 4); //$NON-NLS-1$ long lpfnHook = callback.getAddress (); - if (lpfnHook == 0) error(SWT.ERROR_NO_MORE_CALLBACKS); /* Allocate the Custom Colors and initialize to white */ display = parent.display; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java index 8b44bc9877..986ba52000 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java @@ -723,9 +723,7 @@ void createHandle () { } else { int threadId = OS.GetCurrentThreadId (); Callback cbtCallback = new Callback (this, "CBTProc", 3); //$NON-NLS-1$ - long cbtProc = cbtCallback.getAddress (); - if (cbtProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); - cbtHook = OS.SetWindowsHookEx (OS.WH_CBT, cbtProc, 0, threadId); + cbtHook = OS.SetWindowsHookEx (OS.WH_CBT, cbtCallback.getAddress (), 0, threadId); super.createHandle (); if (cbtHook != 0) OS.UnhookWindowsHookEx (cbtHook); cbtHook = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java index 633576a68c..deee860ea9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java @@ -1006,7 +1006,6 @@ void resizeEmbeddedHandle(long embeddedHandle, int width, int height) { if (display.msgHook == 0) { display.getMsgCallback = new Callback (display, "getMsgProc", 3); display.getMsgProc = display.getMsgCallback.getAddress (); - if (display.getMsgProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); display.msgHook = OS.SetWindowsHookEx (OS.WH_GETMESSAGE, display.getMsgProc, OS.GetLibraryHandle(), threadId); OS.PostThreadMessage (threadId, OS.WM_NULL, 0, 0); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java index 60bda29ccb..edcc8e1cf8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java @@ -188,7 +188,6 @@ private String openCommonFileDialog () { /* Create the BrowseCallbackProc */ Callback callback = new Callback (this, "BrowseCallbackProc", 4); //$NON-NLS-1$ long lpfn = callback.getAddress (); - if (lpfn == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); /* Make the parent shell be temporary modal */ Dialog oldModal = null; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index eef0ff69f8..45904d462f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -2107,9 +2107,7 @@ public Monitor [] getMonitors () { checkDevice (); monitors = new Monitor [4]; Callback callback = new Callback (this, "monitorEnumProc", 4); //$NON-NLS-1$ - long lpfnEnum = callback.getAddress (); - if (lpfnEnum == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); - OS.EnumDisplayMonitors (0, null, lpfnEnum, 0); + OS.EnumDisplayMonitors (0, null, callback.getAddress (), 0); callback.dispose (); Monitor [] result = new Monitor [monitorCount]; System.arraycopy (monitors, 0, result, 0, monitorCount); @@ -2132,7 +2130,6 @@ long getMsgProc (long code, long wParam, long lParam) { null); embeddedCallback = new Callback (this, "embeddedProc", 4); //$NON-NLS-1$ embeddedProc = embeddedCallback.getAddress (); - if (embeddedProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); OS.SetWindowLongPtr (embeddedHwnd, OS.GWLP_WNDPROC, embeddedProc); } if (code >= 0 && (wParam & OS.PM_REMOVE) != 0) { @@ -2648,7 +2645,6 @@ protected void init () { /* Create the callbacks */ windowCallback = new Callback (this, "windowProc", 4); //$NON-NLS-1$ windowProc = windowCallback.getAddress (); - if (windowProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); /* Remember the current thread id */ threadId = OS.GetCurrentThreadId (); @@ -2691,19 +2687,16 @@ protected void init () { OS.SetWindowText(hwndMessage, new TCHAR(0, title, true)); messageCallback = new Callback (this, "messageProc", 4); //$NON-NLS-1$ messageProc = messageCallback.getAddress (); - if (messageProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); OS.SetWindowLongPtr (hwndMessage, OS.GWLP_WNDPROC, messageProc); /* Create the filter hook */ msgFilterCallback = new Callback (this, "msgFilterProc", 3); //$NON-NLS-1$ msgFilterProc = msgFilterCallback.getAddress (); - if (msgFilterProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); filterHook = OS.SetWindowsHookEx (OS.WH_MSGFILTER, msgFilterProc, 0, threadId); /* Create the idle hook */ foregroundIdleCallback = new Callback (this, "foregroundIdleProc", 3); //$NON-NLS-1$ foregroundIdleProc = foregroundIdleCallback.getAddress (); - if (foregroundIdleProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); idleHook = OS.SetWindowsHookEx (OS.WH_FOREGROUNDIDLE, foregroundIdleProc, 0, threadId); /* Register window messages */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java index 7bac8a065d..c81255d7f3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java @@ -335,9 +335,7 @@ public String open () { struct.Flags |= OS.OFN_ALLOWMULTISELECT | OS.OFN_EXPLORER | OS.OFN_ENABLESIZING; if (USE_HOOK) { callback = new Callback (this, "OFNHookProc", 4); //$NON-NLS-1$ - long lpfnHook = callback.getAddress (); - if (lpfnHook == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); - struct.lpfnHook = lpfnHook; + struct.lpfnHook = callback.getAddress (); struct.Flags |= OS.OFN_ENABLEHOOK; } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java index 9233f88519..2ac2a8975b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java @@ -523,7 +523,6 @@ public boolean open () { drawn = false; newProc = new Callback (this, "transparentProc", 4); //$NON-NLS-1$ long newProcAddress = newProc.getAddress (); - if (newProcAddress == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); oldTransparentProc = OS.GetWindowLongPtr (hwndTransparent, OS.GWLP_WNDPROC); OS.SetWindowLongPtr (hwndTransparent, OS.GWLP_WNDPROC, newProcAddress); oldOpaqueProc = OS.GetWindowLongPtr (hwndOpaque, OS.GWLP_WNDPROC); @@ -552,7 +551,6 @@ public boolean open () { null); newProc = new Callback (this, "transparentProc", 4); //$NON-NLS-1$ long newProcAddress = newProc.getAddress (); - if (newProcAddress == 0) error (SWT.ERROR_NO_MORE_CALLBACKS); oldTransparentProc = OS.GetWindowLongPtr (hwndTransparent, OS.GWLP_WNDPROC); OS.SetWindowLongPtr (hwndTransparent, OS.GWLP_WNDPROC, newProcAddress); OS.ShowWindow (hwndTransparent, OS.SW_SHOWNOACTIVATE); |