Mercurial > projects > dwt-win
changeset 88:f92093766455
Fix ColorDialog callback
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 06 Feb 2008 21:58:52 +0100 |
parents | d8bea5e4d514 |
children | 8c6a38719fb8 |
files | dwt/widgets/ColorDialog.d |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/widgets/ColorDialog.d Wed Feb 06 21:58:31 2008 +0100 +++ b/dwt/widgets/ColorDialog.d Wed Feb 06 21:58:52 2008 +0100 @@ -45,6 +45,7 @@ Display display; int width, height; RGB rgb; + private static ColorDialog sThis; /** * Constructs a new instance of this class given only its parent. @@ -101,8 +102,7 @@ } private static extern(Windows) int CCHookFunc (HWND hdlg, uint uiMsg, uint lParam, int lpData) { - ColorDialog dlg = cast(ColorDialog)cast(void*)lpData; - return dlg.CCHookProc( hdlg, uiMsg, lParam ); + return sThis.CCHookProc( hdlg, uiMsg, lParam ); } int CCHookProc (HWND hdlg, uint uiMsg, uint lParam ) { @@ -203,7 +203,12 @@ } /* Open the dialog */ - bool success = cast(bool) OS.ChooseColor (&lpcc); + bool success; + synchronized { + sThis = this; + success = cast(bool) OS.ChooseColor (&lpcc); + sThis = null; + } /* Clear the temporary dialog modal parent */ if ((style & (DWT.APPLICATION_MODAL | DWT.SYSTEM_MODAL)) !is 0) {