ProgressMonitorDialog : Access Violation

Frank Benoit keinfarbton at googlemail.com
Fri Jun 20 04:02:06 PDT 2008


yidabu schrieb:
> jface ProgressMonitorDialog cause runtime Access Violation,
> ddbg captured:
> 
> Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at dwtx.jface.dialog
> s.ProgressMonitorDialog.ProgressMonitorDialog.configureShell.dwt.widgets.Shell.S
> hell.__anonclass95.handleEvent.dwt.widgets.Event.Event.__anonclass96.run (0x0040
> d890) thread(3412)
> 
> tested with dwt-win svn, dwtx svn, dmd 1.028
> 
> Example code:
> 
> 
> import dwt.DWT;
> import dwt.layout.FillLayout;
> import dwt.widgets.Display;
> import dwt.widgets.Shell;
> import dwt.widgets.Listener;
> import dwt.widgets.Event;
> import dwt.widgets.Button;
> 
> import dwtx.jface.dialogs.PopupDialog;
> import dwt.dwthelper.utils;
> 
> import dwtx.jface.dialogs.ProgressMonitorDialog;
> import dwtx.core.runtime.IProgressMonitor;
> import dwtx.jface.operation.IRunnableWithProgress;
> 
> import tango.core.Thread;
> 
> 
> void handleSelection(Event e, Shell shell)
> {
> 
>     void run(IProgressMonitor monitor)
>     {
>         monitor.beginTask("generate", 30);
>         for(int i=0; i<100; i++)
>         {
>             if(monitor.isCanceled())
>             {
>                 return;
>             }
>             monitor.worked(1);
>             Thread.sleep(50);
>         }
>         monitor.done();
>     }
> 
>     auto dialog = new ProgressMonitorDialog(shell);
>     dialog.run(true, true, dgIRunnableWithProgress(&run));
> 
> }
> 
> void main() {
>     final Display display = new Display();
>     final Shell shell = new Shell(display);
>     shell.setLayout(new FillLayout());
>     Button button = new Button(shell, DWT.PUSH);
>     button.setText("&OK");
> 
>     button.addListener(DWT.Selection, dgListener(&handleSelection, shell));
> 
>     shell.pack();
>     shell.open();
>     while (!shell.isDisposed()) {
>         if (!display.readAndDispatch()) display.sleep();
>     }
>     display.dispose();
> }
> 

Thanks for the report yidabu.
It is fixed now.
In your example code, i noticed this:
Thread.sleep(50); // should be 0.050


More information about the Digitalmars-d-dwt mailing list