SWT 不再有句柄 - 在 Windows 7 中

发布于 2024-11-01 02:58:55 字数 7763 浏览 1 评论 0原文

据客户称,我正在开发一个旧的 RCP 应用程序,该应用程序神秘地停止工作。经过一番折腾,我终于拿到了原开发者的电脑(XP的机器)。在那台电脑上运行得很好,很好。

于是我编译了一下,放到另一台XP机器上,运行正常。

在 Windows 7 计算机上运行它,它会显示启动画面,然后在关闭之前短暂显示主 UI。

因此,我将该项目的 Eclipse 工作环境复制到 Windows 7 计算机上,它给了我相同的行为,加上错误消息:

 org.eclipse.swt.SWTError: No more handles

显然,Sleak 应该是内存泄漏的答案,但它也只持续了一段时间整个程序终止之前的第二个。我不认为这是内存泄漏;启动时仅打开两个视图。 Windows 7 中是否有某些内容可能会限制手柄?

这是完整的错误消息:

 org.eclipse.swt.SWTError: No more handles
at org.eclipse.swt.SWT.error(SWT.java:3803)
at org.eclipse.swt.SWT.error(SWT.java:3695)
at org.eclipse.swt.SWT.error(SWT.java:3666)
at org.eclipse.swt.graphics.Image.<init>(Image.java:730)
at org.eclipse.jface.resource.FileImageDescriptor.createImage(FileImageDescriptor.java:176)
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:227)
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:205)
at org.eclipse.gef.ui.palette.editparts.PaletteEditPart$ImageCache.getImage(PaletteEditPart.java:396)
at org.eclipse.gef.ui.palette.editparts.PaletteEditPart.setImageDescriptor(PaletteEditPart.java:353)
at org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart.refreshVisuals(ToolEntryEditPart.java:455)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:676)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:727)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:677)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:727)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:677)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198)
at org.eclipse.gef.editparts.SimpleRootEditPart.setContents(SimpleRootEditPart.java:101)
at org.eclipse.gef.ui.palette.PaletteViewer.setPaletteRoot(PaletteViewer.java:397)
at org.eclipse.gef.EditDomain.setPaletteViewer(EditDomain.java:360)
at org.eclipse.gef.ui.palette.PaletteViewerProvider.hookPaletteViewer(PaletteViewerProvider.java:76)
at org.eclipse.gef.ui.palette.PaletteViewerProvider.createPaletteViewer(PaletteViewerProvider.java:59)
at org.eclipse.gef.ui.views.palette.PaletteViewerPage.createControl(PaletteViewerPage.java:63)
at org.eclipse.gef.ui.views.palette.PaletteView.doCreatePage(PaletteView.java:100)
at org.eclipse.ui.part.PageBookView.createPage(PageBookView.java:399)
at org.eclipse.ui.part.PageBookView.partActivated(PageBookView.java:741)
at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:72)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.PartListenerList.fireEvent(PartListenerList.java:57)
at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:70)
at org.eclipse.ui.internal.PartService.firePartActivated(PartService.java:186)
at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:305)
at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:56)
at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:126)
at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3491)
at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:610)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2832)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2729)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2721)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2673)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2652)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2635)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:708)
at [companyname].gef.ApplicationWorkbenchWindowAdvisor.postWindowOpen(ApplicationWorkbenchWindowAdvisor.java:111)
at org.eclipse.ui.internal.WorkbenchWindow.fireWindowOpened(WorkbenchWindow.java:1229)
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:786)
at org.eclipse.ui.internal.Workbench$22.runWithException(Workbench.java:1043)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$27.runWithException(Workbench.java:1363)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2295)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at [companyname].gef.Application.start(Application.java:28)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)

I'm working on an old RCP application that mysteriously stopped working, according to the client. After much frustration, I finally got a hold of the original developer's computer (an XP machine). It runs fine on that computer, nice.

So I compile it and put it on another XP machine, and it runs fine.

Run it on a Windows 7 machine, and it shows the splashscreen, then the main UI for a split second before closing.

So I copied the Eclipse work environment for that project over to the Windows 7 machine, and it gives me the same behavior, plus the error message:

 org.eclipse.swt.SWTError: No more handles

Apparently, Sleak is supposed to be the answer for memory leaks, but it also lasts only a split second before the whole program dies. I don't think it's a memory leak; only two views are opened on startup. Is there something in Windows 7 that might be restricting the handles?

Here is the full error message:

 org.eclipse.swt.SWTError: No more handles
at org.eclipse.swt.SWT.error(SWT.java:3803)
at org.eclipse.swt.SWT.error(SWT.java:3695)
at org.eclipse.swt.SWT.error(SWT.java:3666)
at org.eclipse.swt.graphics.Image.<init>(Image.java:730)
at org.eclipse.jface.resource.FileImageDescriptor.createImage(FileImageDescriptor.java:176)
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:227)
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:205)
at org.eclipse.gef.ui.palette.editparts.PaletteEditPart$ImageCache.getImage(PaletteEditPart.java:396)
at org.eclipse.gef.ui.palette.editparts.PaletteEditPart.setImageDescriptor(PaletteEditPart.java:353)
at org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart.refreshVisuals(ToolEntryEditPart.java:455)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:676)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:727)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:677)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:727)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:677)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198)
at org.eclipse.gef.editparts.SimpleRootEditPart.setContents(SimpleRootEditPart.java:101)
at org.eclipse.gef.ui.palette.PaletteViewer.setPaletteRoot(PaletteViewer.java:397)
at org.eclipse.gef.EditDomain.setPaletteViewer(EditDomain.java:360)
at org.eclipse.gef.ui.palette.PaletteViewerProvider.hookPaletteViewer(PaletteViewerProvider.java:76)
at org.eclipse.gef.ui.palette.PaletteViewerProvider.createPaletteViewer(PaletteViewerProvider.java:59)
at org.eclipse.gef.ui.views.palette.PaletteViewerPage.createControl(PaletteViewerPage.java:63)
at org.eclipse.gef.ui.views.palette.PaletteView.doCreatePage(PaletteView.java:100)
at org.eclipse.ui.part.PageBookView.createPage(PageBookView.java:399)
at org.eclipse.ui.part.PageBookView.partActivated(PageBookView.java:741)
at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:72)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.PartListenerList.fireEvent(PartListenerList.java:57)
at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:70)
at org.eclipse.ui.internal.PartService.firePartActivated(PartService.java:186)
at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:305)
at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:56)
at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:126)
at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3491)
at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:610)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2832)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2729)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2721)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2673)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2652)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2635)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:708)
at [companyname].gef.ApplicationWorkbenchWindowAdvisor.postWindowOpen(ApplicationWorkbenchWindowAdvisor.java:111)
at org.eclipse.ui.internal.WorkbenchWindow.fireWindowOpened(WorkbenchWindow.java:1229)
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:786)
at org.eclipse.ui.internal.Workbench$22.runWithException(Workbench.java:1043)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$27.runWithException(Workbench.java:1363)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2295)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at [companyname].gef.Application.start(Application.java:28)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

思慕 2024-11-08 02:58:55

如果某些功能在 Win XP 上运行良好但在 Win 7 上不起作用,则可能是 SWT 错误。我建议您在 Eclipse bugzilla 中提出一个错误。

If something works fine on Win XP and doesn't work on Win 7, then its potentially an SWT bug. I suggest you raise a bug in the Eclipse bugzilla.

挽容 2024-11-08 02:58:55

我遇到过很多次这种情况,这与资源的处置有关。您可能正在创建 Font、Image 对象,但没有通过显式调用 .dispose() 来释放它们。我怀疑它与 Windows 7 有关,它也会发生在 Windows 7 上,但可能需要更长时间才能发生,因为该计算机上可能有更多可用的系统资源。确保跟踪并处置分配的资源通常可以解决问题。

I've had this a number of times, it's related to disposing of resources. You may be creating Font, Image objects and not releasing them by explicitly calling .dispose(). I doubt it's related to Windows 7, it would happen there too but might take longer to happen as you might have more system resources available on that machine. Making sure you track and dispose of your allocated resources normally solves the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文