Community
Participate
Working Groups
Build Identifier: I20100608-0911 If no printers are installed on xp, rcp application crashes when the following line is executed: PrintDialog dialog = new PringDialog(shell, SWT.NONE); Stack: [0x00030000,0x00130000], sp=0x0012ed6c, free space=3fb0012e8a0k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [swt-win32-3557.dll+0x2c263] C [swt-win32-3557.dll+0xa3b5] j org.eclipse.swt.internal.win32.OS.MoveMemory(Lorg/eclipse/swt/internal/win32/DEVMODEW;II)V+0 j org.eclipse.swt.internal.win32.OS.MoveMemory(Lorg/eclipse/swt/internal/win32/DEVMODE;II)V+12 j org.eclipse.swt.printing.PrintDialog.open()Lorg/eclipse/swt/printing/PrinterData;+168 j com.teamcenter.rac.services.PrintService.printImage(Lcom/teamcenter/rac/print/IGraphicInfo;)V+30 j com.teamcenter.rac.handlers.PrintGraphicsHandler.execute(Lorg/eclipse/core/commands/ExecutionEvent;)Ljava/lang/Object;+44 j org.eclipse.ui.internal.handlers.HandlerProxy.execute(Lorg/eclipse/core/commands/ExecutionEvent;)Ljava/lang/Object;+33 j org.eclipse.core.commands.Command.executeWithChecks(Lorg/eclipse/core/commands/ExecutionEvent;)Ljava/lang/Object;+115 j org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+21 j org.eclipse.ui.internal.handlers.HandlerService.executeCommand(Lorg/eclipse/core/commands/ParameterizedCommand;Lorg/eclipse/swt/widgets/Event;)Ljava/lang/Object;+6 j org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(Lorg/eclipse/core/commands/ParameterizedCommand;Lorg/eclipse/swt/widgets/Event;)Ljava/lang/Object;+6 j org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(Lorg/eclipse/core/commands/ParameterizedCommand;Lorg/eclipse/swt/widgets/Event;)Ljava/lang/Object;+6 j org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(Lorg/eclipse/swt/widgets/Event;)V+79 j org.eclipse.ui.menus.CommandContributionItem.access$10(Lorg/eclipse/ui/menus/CommandContributionItem;Lorg/eclipse/swt/widgets/Event;)V+2 j org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(Lorg/eclipse/swt/widgets/Event;)V+51 J org.eclipse.swt.widgets.EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V J org.eclipse.swt.widgets.Display.runDeferredEvents()Z J org.eclipse.swt.widgets.Display.readAndDispatch()Z j org.eclipse.ui.internal.Workbench.runEventLoop(Lorg/eclipse/jface/window/Window$IExceptionHandler;Lorg/eclipse/swt/widgets/Display;)V+9 j org.eclipse.ui.internal.Workbench.runUI()I+393 j org.eclipse.ui.internal.Workbench.access$4(Lorg/eclipse/ui/internal/Workbench;)I+1 j org.eclipse.ui.internal.Workbench$5.run()V+55 j org.eclipse.core.databinding.observable.Realm.runWithDefault(Lorg/eclipse/core/databinding/observable/Realm;Ljava/lang/Runnable;)V+12 j org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+18 j org.eclipse.ui.PlatformUI.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+2 j com.teamcenter.rac.aifrcp.Application.runApplication(Ljava/lang/Object;)Ljava/lang/Object;+71 j com.teamcenter.rac.aifrcp.Application.start(Lorg/eclipse/equinox/app/IApplicationContext;)Ljava/lang/Object;+16 j org.eclipse.equinox.internal.app.EclipseAppHandle.run(Ljava/lang/Object;)Ljava/lang/Object;+135 j org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Ljava/lang/Object;)Ljava/lang/Object;+103 j org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Ljava/lang/Object;)Ljava/lang/Object;+29 j org.eclipse.core.runtime.adaptor.EclipseStarter.run(Ljava/lang/Object;)Ljava/lang/Object;+149 j org.eclipse.core.runtime.adaptor.EclipseStarter.run([Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object;+183 v ~StubRoutines::call_stub V [jvm.dll+0xf049c] V [jvm.dll+0x17fcf1] V [jvm.dll+0xf051d] V [jvm.dll+0x199ceb] V [jvm.dll+0x19a706] V [jvm.dll+0x11bc03] C [java.dll+0x714d] j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87 j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+161 j org.eclipse.equinox.launcher.Main.invokeFramework([Ljava/lang/String;[Ljava/net/URL;)V+211 j org.eclipse.equinox.launcher.Main.basicRun([Ljava/lang/String;)V+114 j org.eclipse.equinox.launcher.Main.run([Ljava/lang/String;)I+4 v ~StubRoutines::call_stub V [jvm.dll+0xf049c] V [jvm.dll+0x17fcf1] V [jvm.dll+0xf051d] V [jvm.dll+0xf9e0f] V [jvm.dll+0xfbae4] C [eclipse_1206.dll+0x5196] C [eclipse_1206.dll+0x4721] C [eclipse_1206.dll+0x152c] C [Teamcenter.exe+0x1495] C [Teamcenter.exe+0x1181] C [Teamcenter.exe+0x4a3a] C [kernel32.dll+0x17077] It works on windows 7, and it also works on xp if one or more printer are installed. Reproducible: Always
The crash can't be happening when the PrintDialog is created - it looks like it is crashing when the dialog is opened, i.e. on this line: dialog.open(); I will try to replicate this, but in the meantime, you might want to add something like the following to your code before creating (or opening) the PrintDialog: PrinterData printerList[] = Printer.getPrinterList(); if (printerList.length == 0) { // There are no printers. Warn the user, or disable the menu item, etc. // i.e. do not try to open a print dialog return; } Also, are you by any chance using PrintDialog.setPrinterData(data) with data that was stored from a real printer originally? I can see that that might cause a problem. I will try to protect against that.
Fixed > 20110411 OK, I have protected against anyone giving old PrinterData before opening the PrintDialog. I believe this will fix your problem. This code is in HEAD now. I did not try it without any printers because I do not want to delete all of my printers <g>. However I am pretty sure that this is the correct fix. If you still crash using a build created after today, please reopen this bug.