bug in wxCreateHiddenWindow function

Eran Ifrah eran.ifrah at gmail.com
Sat Aug 25 09:32:34 PDT 2007


Ok, I suspect that the problem is that  gs_classForHiddenWindow  is NULL
when called from the DLL for the first time, while it contains valid value
when called from the application code (not the DLL).

I debugged it further, and it appears that gs_classForHiddenWindow has
multiple instances:

- wxExecute called from application 1st time: gs_classForHiddenWindow =3D N=
ULL
- wxExecute called from application 2nd time: gs_classForHiddenWindow
contains valid value, so RegisterClass is skipped
- wxExecute called from the DLL for the 1st time - gs_classForHiddenWindow =
=3D
NULL - and now the assertion will occur since it is trying to register the
same class again.

I still thinks that changing the test condition to what I suggested can
solve this problem.
Or maybe I am doing something bad when using the DLL...

Regards,
Eran

On 8/25/07, Robert Roebling <robert at roebling.de> wrote:
>
> Eran Ifrah wrote:
>
> > I tried to call wxExecute from within a dll (does it matter?), however
> > I am getting an assertion
> > 'failed to create hidden window for wxExecute'. Stepping into WX
> > sources, I found the bugged line:
> >
> > at utils.cpp, line 1533 (in function wxCreateHiddenWindow()):
> >
> > if ( !::RegisterClass(&wndclass)  )
> > {
> >     [...]
> > }
> >
> > the above condition should be modified to:
> > if ( !::RegisterClass(&wndclass)  && GetLastError() !=3D
> > ERROR_CLASS_ALREADY_EXISTS )
> >
> > I have tested it and with my fix, the code works properly (I am
> > getting the process termination event).
>
> Maybe ::RegisterClass(&wndclass) should only get called once?
> It doesn't seem obviously right to ignore an error message.
>
>   Robert
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>


-- =

Eran Ifrah
eran.ifrah at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20070825/bb1=
eaeec/attachment.htm


More information about the wx-users mailing list