Community
Participate
Working Groups
Created attachment 75424 [details] crash log Build ID: M20070212-1330 Steps To Reproduce: 1. On a preference page I open a popup dialog 2. From that one I open a standard Open File Dialog 3. The application craches More information:
(In reply to comment #0) > Created an attachment (id=75424) [details] > crash log > > Build ID: M20070212-1330 > > Steps To Reproduce: > 1. On a preference page I open a popup dialog > 2. From that one I open a standard Open File Dialog > 3. The application craches > > > More information: > This is how I create popup dialog: public PropertiesPopupDialog(Shell shell, ISelectionProvider selectionProvider) { super(shell, SWT.RESIZE | SWT.PRIMARY_MODAL, false, true, true, true, UIResources.getString(IDS_DIALOG_PROPERTIES_TITLE), null); this.selectionProvider = selectionProvider; }
Created attachment 75425 [details] shows how the application crashes
This is the cell editor in property sheet that supposed to opend the FileDialog, but instead it crashes the application. public class FileCellEditor extends DialogCellEditor { private static final String ALL_FILTER = "*.*"; //$NON-NLS-N$ private static final String LOG_FILTER = "*.log"; //$NON-NLS-N$ public FileCellEditor(Composite parent) { super(parent); } @Override protected Object openDialogBox(Control cellEditorWindow) { FileDialog fileDialog = new FileDialog(cellEditorWindow.getShell(), SWT.RESIZE | SWT.OPEN); fileDialog.setFilterExtensions(new String[]{LOG_FILTER, ALL_FILTER}); // filters String file = fileDialog.open(); return file; } }
I changed opening of the dialog to this code and it stopped crashing: FileDialog fileDialog = new FileDialog(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(), SWT.RESIZE | SWT.OPEN); Does that mean, that I should not be using shell from the passed parameter?
I just had a look at rg.eclipse.jface.viewers.ColorCellEditor and this is how it opens a dialog protected Object openDialogBox(Control cellEditorWindow) { ColorDialog dialog = new ColorDialog(cellEditorWindow.getShell()); Object value = getValue(); if (value != null) { dialog.setRGB((RGB) value); } value = dialog.open(); return dialog.getRGB(); } I did the same, but under the circumstances, I have discribed - it crashes the application...
So, taking the shell from the active workbench does not crash the application, but it closes the Popup dialog, which I do not want, besides it does not explain the fact that the application crashes...
The crash happens because the parent of the file dialog was disposed when the file dialog was opened. Moving to jface (owners of PopupDialog).
Susan, based on Kevin's comments this looks to be more of a Dialog rather than a CE issue...could you take a look?
I'll take a look. I suspect that PopupDialog is getting a shell deactivate during this sequence and closes itself while the file dialog is being created. Kevin, it is expected that a crash occurs if a disposed parent is used? That seems awful harsh vs. the normal widget disposed exception.
I've managed to recreate the problem (on 3.4 stream) with a simplified snippet. The crash only occurs if a file dialog is being opened. I tried some JFace dialogs (color dialog, input dialog), and the popup dialog closes, but no crash. I also tried opening an SWT message box, and again, the popup dialog closes, but no crash. So I think it is an SWT issue that FileDialog handles the disposed parent case with a crash. I will investigate on my end why the dialog is closing when a child dialog is created. The intention is that popup dialog closes when its shell is deactivated by a non-child shell. I need to figure out why it does not recognize the dialog shell as its child...
Created attachment 75777 [details] PopupDialogCrashTest snippet which demonstrates the crash
Peter, I don't think we will have a simple solution to this, so I think your best course of action right now is to use a regular dialog instead of PopupDialog. I think you are pushing PopupDialog past its design intentions. From the javadoc: * A lightweight, transient dialog that is popped up to show contextual or * temporal information and is easily dismissed. Your properties dialog is really more of a normal dialog as far as its interaction goes. If you like the look of popup dialog, you could use similar style bits and colors. PopupDialog intentionally closes when deactivated (part of meeting the "easily dismissed" requirement). We do our best to catch the cases where we activate other shells ourselves, but still have issues on some platforms, even when we have created the shells (for example see bug #113577). It's not a simple matter to make PopupDialog more resilient to other shells getting activated, because we just don't have the SWT support we need to be smarter about when to close. As for the crash on file dialog vs. simply dismissing the popup, I consider this to be a special case with file dialog's timing, and brittle error handling. We could continue to chase this, but I believe it's out of JFace's control and probably SWT's control. Fixing it would still leave you (best case) with a properties dialog that dismisses itself as soon as you invoked the cell editor's dialog, or with a widget disposed exception. Changing the title to reflect the problem from JFace's point of view. You may want to open a separate bug against SWT for the crash (vs. a disposed exception).
Susan, thanks for your detailed comments. Ok, I will then get rid of a Popup dialog. It just a bit strange, that the application crashes completely. I mean, usually an exception is thrown and the application carries on, but here the application dies immediately in a worst possible manner. :) In addition, I will not create a separate bug - it is probably up to the developers what to do, because I managed to explain it in the way so that you understood.
I agree the crash is bogus. Steve, do you want me to open a separate SWT bug for this? I'm sure we are doing something wrong (like disposing the dialog's parent while it is getting activated), but a system crash is harsh. Note it's only FileDialog, not other dialogs.
as per 2009 triage guidelines
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.