Jump to page: 1 2
Thread overview
ProgressMonitorDialog : Access Violation
Jun 20, 2008
yidabu
Jun 20, 2008
Frank Benoit
Jun 20, 2008
yidabu
Jun 20, 2008
Frank Benoit
Jun 21, 2008
yidabu
Jun 21, 2008
yidabu
Jun 21, 2008
yidabu
Jun 21, 2008
yidabu
Jun 21, 2008
Frank Benoit
Jun 21, 2008
Frank Benoit
Jun 21, 2008
yidabu
June 20, 2008
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();
}

-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


June 20, 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
June 20, 2008
On Fri, 20 Jun 2008 13:02:06 +0200
Frank Benoit <keinfarbton@googlemail.com> wrote:

> 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

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

update to svn, still not work:
runtime exception:


Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at dwtx.jface.dialog
s.ProgressMonitorDialog.ProgressMonitorDialog.setMessage (0x0040dc1a) thread(266
8)
->us
#0 void dwtx.jface.dialogs.ProgressMonitorDialog.ProgressMonitorDialog.setMessag
e(char[], bool, void*) () at DwtTest.d:42 from ProgressMonitorDialog
#1 0x0040d8a1 in void dwtx.jface.dialogs.ProgressMonitorDialog.ProgressMonitorDi
alog.configureShell(class dwt.widgets.Shell.Shell, void*) . void __anonclass94.h
andleEvent(class dwt.widgets.Event.Event, void*) . void __anonclass95.run(void*)
 () at DwtTest.d:42 from ProgressMonitorDialog
#2 0x004b6ca4 in bool dwt.widgets.Synchronizer.Synchronizer.runAsyncMessages(boo
l, void*) () at DwtTest.d:42 from Synchronizer
#3 0x004592c3 in bool dwt.widgets.Display.Display.runAsyncMessages(bool, void*)
() at DwtTest.d:42 from Display
#4 0x00414019 in void dwtx.jface.operation.ModalContext.ModalContext.ModalContex
tThread.block(void*) () at DwtTest.d:42 from ModalContext
#5 0x00414261 in void dwtx.jface.operation.ModalContext.ModalContext.run(class d
wtx.jface.operation.IRunnableWithProgress.IRunnableWithProgress, bool, class dwt
x.core.runtime.IProgressMonitor.IProgressMonitor, class dwt.widgets.Display.Disp
lay) () at DwtTest.d:42 from ModalContext
#6 0x0040daf2 in void dwtx.jface.dialogs.ProgressMonitorDialog.ProgressMonitorDi
alog.run(bool, bool, class dwtx.jface.operation.IRunnableWithProgress.IRunnableW
ithProgress, void*) () at DwtTest.d:42 from ProgressMonitorDialog
#7 0x0040406c in  DwtTest.handleSelection () at DwtTest.d:42
#8 0x0040429f in  dwt.widgets.Listener._DgListenerT! () at DwtTest.d:60 from Dwt
Test.obj
#9 0x004b725a in void dwt.widgets.EventTable.EventTable.sendEvent(class dwt.widg
ets.Event.Event, void*) () at DwtTest.d:60 from EventTable
#10 0x0047e8ad in void dwt.widgets.Widget.Widget.sendEvent(class dwt.widgets.Eve



-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


June 20, 2008
yidabu schrieb:
> On Fri, 20 Jun 2008 13:02:06 +0200
> Frank Benoit <keinfarbton@googlemail.com> wrote:
> 
>> 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
> 
>> Thanks for the report yidabu.
>> It is fixed now.
>> In your example code, i noticed this:
>> Thread.sleep(50); // should be 0.050
> 
> update to svn, still not work:
> ...

strange.
I tested it on linux and windows.
are you sure you updated dwt-addons?
this was the fix: http://www.dsource.org/projects/dwt-addons/changeset/83%3A028aedd523ad
June 21, 2008
On Sat, 21 Jun 2008 01:49:56 +0200
Frank Benoit <keinfarbton@googlemail.com> wrote:

> yidabu schrieb:
> > On Fri, 20 Jun 2008 13:02:06 +0200
> > Frank Benoit <keinfarbton@googlemail.com> wrote:
> > 
> >> 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
> > 
> >> Thanks for the report yidabu.
> >> It is fixed now.
> >> In your example code, i noticed this:
> >> Thread.sleep(50); // should be 0.050
> > 
> > update to svn, still not work:
> > ...
> 
> strange.
> I tested it on linux and windows.
> are you sure you updated dwt-addons?
> this was the fix:
> http://www.dsource.org/projects/dwt-addons/changeset/83%3A028aedd523ad


perhaps the issue is I have not add -full to dsss buildflags to build a static dwtx.lib. now I rebuild dwtx.lib, it may take two hours.

-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


June 21, 2008
> > >> Thanks for the report yidabu.
> > >> It is fixed now.
> > >> In your example code, i noticed this:
> > >> Thread.sleep(50); // should be 0.050
> > > 
> > > update to svn, still not work:
> > > ...
> > 
> > strange.
> > I tested it on linux and windows.
> > are you sure you updated dwt-addons?
> > this was the fix:
> > http://www.dsource.org/projects/dwt-addons/changeset/83%3A028aedd523ad
> 
> 
> perhaps the issue is I have not add -full to dsss buildflags to build a static dwtx.lib. now I rebuild dwtx.lib, it may take two hours.
> 


added -full dsss buildflag and got a new dwtx.lib, but get same object.Exception: Access Violation

should remove dsss_objs and dsss_imports directory first to build dwtx.lib ?



-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


June 21, 2008
On Sat, 21 Jun 2008 08:52:30 +0800
yidabu <yidabu.spam@gmail.com> wrote:

> 
> > > >> Thanks for the report yidabu.
> > > >> It is fixed now.
> > > >> In your example code, i noticed this:
> > > >> Thread.sleep(50); // should be 0.050
> > > > 
> > > > update to svn, still not work:
> > > > ...
> > > 
> > > strange.
> > > I tested it on linux and windows.
> > > are you sure you updated dwt-addons?
> > > this was the fix:
> > > http://www.dsource.org/projects/dwt-addons/changeset/83%3A028aedd523ad
> > 
> > 
> > perhaps the issue is I have not add -full to dsss buildflags to build a static dwtx.lib. now I rebuild dwtx.lib, it may take two hours.
> > 
> 
> 
> added -full dsss buildflag and got a new dwtx.lib, but get same object.Exception: Access Violation
> 
> should remove dsss_objs and dsss_imports directory first to build dwtx.lib ?

dsss_objs and dsss_imports removed, but still not work
I'm no idea that why PopupDialog works but rogressMonitorDialog failed after update to svn.


-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


June 21, 2008
> >>> tested with dwt-win svn, dwtx svn, dmd 1.028
> > 
> >> Thanks for the report yidabu.
> >> It is fixed now.
> >> In your example code, i noticed this:
> >> Thread.sleep(50); // should be 0.050
> > 
> > update to svn, still not work:
> > ...
> 
> strange.
> I tested it on linux and windows.
> are you sure you updated dwt-addons?
> this was the fix:
> http://www.dsource.org/projects/dwt-addons/changeset/83%3A028aedd523ad

change :
dialog.run(true, true, dgIRunnableWithProgress(&run));
to:
dialog.run(false, true, dgIRunnableWithProgress(&run));

Progress bar worked, and after monitor.done(), cause Exception:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at dwtx.jface.dialog
s.ProgressMonitorDialog.ProgressMonitorDialog.configureShell.dwt.widgets.Shell.S
hell.__anonclass94.handleEvent.dwt.widgets.Event.Event.__anonclass95.run (0x0040
d891) thread(2004)

seems it's another anonclass problem.


-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


June 21, 2008
yidabu schrieb:
>>>>> tested with dwt-win svn, dwtx svn, dmd 1.028
>>>> Thanks for the report yidabu.
>>>> It is fixed now.
>>>> In your example code, i noticed this:
>>>> Thread.sleep(50); // should be 0.050
>>> update to svn, still not work:
>>> ...
>> strange.
>> I tested it on linux and windows.
>> are you sure you updated dwt-addons?
>> this was the fix: http://www.dsource.org/projects/dwt-addons/changeset/83%3A028aedd523ad
> 
> change :
> dialog.run(true, true, dgIRunnableWithProgress(&run));
> to:
> dialog.run(false, true, dgIRunnableWithProgress(&run));
> 
> Progress bar worked, and after monitor.done(), cause Exception:
> 
> Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at dwtx.jface.dialog
> s.ProgressMonitorDialog.ProgressMonitorDialog.configureShell.dwt.widgets.Shell.S
> hell.__anonclass94.handleEvent.dwt.widgets.Event.Event.__anonclass95.run (0x0040
> d891) thread(2004)
> 
> seems it's another anonclass problem.
> 
> 

i had tested it with dmd 1.031 ... and indeed with dmd 1.028 it crashes.
Your first example code should work now.
With the
> dialog.run(false, true, dgIRunnableWithProgress(&run));
there is still a problem :/
June 21, 2008
Frank Benoit schrieb:
> i had tested it with dmd 1.031 ... and indeed with dmd 1.028 it crashes.
> Your first example code should work now.
> With the
>  > dialog.run(false, true, dgIRunnableWithProgress(&run));
> there is still a problem :/

Now it works with fork=false, but another anon class workaround was necessary.

Also a fix in the example code is needed to make fork=false work. From the ProgressMonitorDialog doc:
If fork is set to false, the runnable will run in the UI thread and it is the runnable's responsibility to call Display.readAndDispatch()  to ensure UI responsiveness.

The example code looks now like this:

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;

version=NOFORK;

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(0.050);
            version(NOFORK) Display.getCurrent().readAndDispatch();
        }
        monitor.done();
        version(NOFORK) Display.getCurrent().readAndDispatch();
    }
    auto dialog = new ProgressMonitorDialog(shell);
    version(NOFORK) {
        dialog.run(false, true, dgIRunnableWithProgress(&run));
    } else {
        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();
}

« First   ‹ Prev
1 2