www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - ui.forms.widgets.Hyperlink : Summary: 1 Cursor(s) Exception in

reply yidabu <yidabu.spam gmail.com> writes:
code bellow not crashed, but cause Exception:
Summary: 1 Cursor(s) Exception in (0): 

when exit program, ddbg captured :
Unhandled D Exception (tango.core.Exception.IOException
 "<console> :: The handle is invalid.") at KERNEL32.dll (0x7c812a5b) thread(2644
)

Does it means some resource not auto released ?
Or Hyperlink works with dwtx.ui.forms.widgets.Form only ?



Code:

module DwtTest;

import dwt.DWT;
import dwt.widgets.Display;
import dwt.widgets.Shell;

import dwtx.ui.forms.widgets.Hyperlink;

void main(){
    Display display = new Display ();
    Shell shell = new Shell (display);
    
    /// cause Summary: 1 Cursor(s) Exception in (0): 
    auto linkHome = new Hyperlink(shell, DWT.NONE);  
    
    linkHome.setText(" http://www.d-programming-language-china.org/ ");
    linkHome.setUnderlined(true);
    linkHome.setForeground(shell.getDisplay().getSystemColor(DWT.COLOR_BLUE));
    linkHome.setSize (300, 200); //to show the link
    
    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/
Jun 13 2008
parent Frank Benoit <keinfarbton googlemail.com> writes:
yidabu schrieb:
 code bellow not crashed, but cause Exception:
 Summary: 1 Cursor(s) Exception in (0): 
 
 when exit program, ddbg captured :
 Unhandled D Exception (tango.core.Exception.IOException
  "<console> :: The handle is invalid.") at KERNEL32.dll (0x7c812a5b)
thread(2644
 )
 
 Does it means some resource not auto released ?
 Or Hyperlink works with dwtx.ui.forms.widgets.Form only ?
 
 
 
 Code:
 
 module DwtTest;
 
 import dwt.DWT;
 import dwt.widgets.Display;
 import dwt.widgets.Shell;
 
 import dwtx.ui.forms.widgets.Hyperlink;

import dwtx.ui.internal.forms.widgets.FormsResources;
 
 void main(){
     Display display = new Display ();
     Shell shell = new Shell (display);
     
     /// cause Summary: 1 Cursor(s) Exception in (0): 
     auto linkHome = new Hyperlink(shell, DWT.NONE);  
     
     linkHome.setText(" http://www.d-programming-language-china.org/ ");
     linkHome.setUnderlined(true);
     linkHome.setForeground(shell.getDisplay().getSystemColor(DWT.COLOR_BLUE));
     linkHome.setSize (300, 200); //to show the link
     
     shell.pack();
     shell.open ();
     while (!shell.isDisposed ()) {
         if (!display.readAndDispatch ()) display.sleep ();
     }

FormsResources.shutdown();
     display.dispose ();
 }
 
 

Hm, this is strange. The HyperLink uses FormsResources to create the used Cursors. But the Cursor is not release, hence this message. To release, i added the call "FormsResources.shutdown();" and the message goes away. But the modules location in the "internal" package implies that it should not be necessary to access it from user code. But the "shutdown()" method is called from nowhere else.
Jun 20 2008