I've been having a problem that only surfaces on some installs of
Windows, on most installs it works fine but on a few (mostly Vista but
also XP) the application fails to run giving the error "The application
failed to initialize properly (0xc0000005)" twice. This bug is
consistent between builds by different MSVC versions and it's always the
same PCs that fail.

Attached is a minimal example that produces the effect. If I remove the
call to wxLuaBinding_wx_init() the bug goes away, though I can no longer
use the wxLuaState instances.

Is there anything I'm missing in the initialization of the wxLua
environment and how can this only show on certain PCs?

Build environment:
MSVC++.Net 2003 (7.1) and 2005 (8), wxLua 2.8.4.1 (unicode dll
multilib), wxWidgets 2.8.4 and 2.8.7 (unicode dll)

Scott

ntsd output if it helps:
 
Microsoft (R) Windows User-Mode Debugger  Version 5.1.2600.0
Copyright (c) Microsoft Corporation. All rights reserved.
 
CommandLine: wxTest004.exe
Loaded dbghelp extension DLL
The call to LoadLibrary(ext) failed with error 2.
Please check your debugger configuration and/or network access
Loaded exts extension DLL
The call to LoadLibrary(uext) failed with error 2.
Please check your debugger configuration and/or network access
Loaded ntsdexts extension DLL
Symbol search path is: *** Invalid *** : Verify _NT_SYMBOL_PATH setting
Executable search path is:
ModLoad: 00400000 0043d000   wxTest004.exe
ModLoad: 7c900000 7c9b0000   ntdll.dll
ModLoad: 7c800000 7c8f5000   C:\WINDOWS\system32\kernel32.dll
ModLoad: 10000000 1004e000   C:\wxTest004_d\wxlua_msw28ud_wxlua.dll
ModLoad: 00320000 0034f000   C:\wxTest004_d\lua5.1d.dll
ModLoad: 10200000 10287000   C:\wxTest004_d\MSVCR71D.dll
ModLoad: 00440000 0061f000   C:\wxTest004_d\wxbase28ud_vc_custom.dll
ModLoad: 7e410000 7e4a0000   C:\WINDOWS\system32\USER32.dll
ModLoad: 77f10000 77f57000   C:\WINDOWS\system32\GDI32.dll
ModLoad: 77dd0000 77e6b000   C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77e70000 77f01000   C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 7c9c0000 7d1d5000   C:\WINDOWS\system32\SHELL32.dll
ModLoad: 77c10000 77c68000   C:\WINDOWS\system32\msvcrt.dll
ModLoad: 77f60000 77fd6000   C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 774e0000 7761d000   C:\WINDOWS\system32\ole32.dll
ModLoad: 10480000 1053c000   C:\wxTest004_d\MSVCP71D.dll
ModLoad: 00620000 00a79000   C:\wxTest004_d\wxmsw28ud_core_vc_custom.dll
ModLoad: 5d090000 5d12a000   C:\WINDOWS\system32\COMCTL32.dll
ModLoad: 763b0000 763f9000   C:\WINDOWS\system32\comdlg32.dll
ModLoad: 77120000 771ab000   C:\WINDOWS\system32\OLEAUT32.dll
ModLoad: 00a80000 00ead000   C:\wxTest004_d\wxlua_msw28ud_wxbind.dll
ModLoad: 00350000 00389000   C:\wxTest004_d\wxbase28ud_xml_vc_custom.dll
ModLoad: 00390000 003c3000   C:\wxTest004_d\wxbase28ud_net_vc_custom.dll
ModLoad: 71ad0000 71ad9000   C:\WINDOWS\system32\WSOCK32.dll
ModLoad: 71ab0000 71ac7000   C:\WINDOWS\system32\WS2_32.dll
ModLoad: 71aa0000 71aa8000   C:\WINDOWS\system32\WS2HELP.dll
ModLoad: 00eb0000 00fa2000   C:\wxTest004_d\wxmsw28ud_adv_vc_custom.dll
ModLoad: 76b40000 76b6d000   C:\WINDOWS\system32\WINMM.dll
ModLoad: 003d0000 003fe000   C:\wxTest004_d\wxmsw28ud_media_vc_custom.dll
ModLoad: 00fb0000 01054000   C:\wxTest004_d\wxmsw28ud_html_vc_custom.dll
ModLoad: 01060000 01105000   C:\wxTest004_d\wxmsw28ud_xrc_vc_custom.dll
ModLoad: 773d0000 774d3000  
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Cont
rols_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
Access violation - code c0000005 (first chance)
eax=01e3f4dc ebx=00f252f0 ecx=ffffffff edx=ffffffff esi=0012f988
edi=00000001
eip=0047f474 esp=0012f94c ebp=0012f950 iopl=0         nv up ei pl zr na
po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000            
efl=00000246
*** WARNING: Unable to verify checksum for
C:\wxTest004_d\wxbase28ud_vc_custom.d
ll
*** ERROR: Symbol file could not be found.  Defaulted to export symbols
for C:\w
xTest004_d\wxbase28ud_vc_custom.dll -
wxbase28ud_vc_custom!wxEventTableEntryBase__wxEventTableEntryBase+14:
0047f474 8908             mov     [eax],ecx        
ds:0023:01e3f4dc=????????
0:000> kb
ChildEBP RetAddr  Args to Child
WARNING: Stack unwind information not available. Following frames may be
wrong.
0012f950 0047f516 ffffffff ffffffff 00ed9ff0
wxbase28ud_vc_custom!wxEventTableEn
tryBase__wxEventTableEntryBase+0x14
*** WARNING: Unable to verify checksum for
C:\wxTest004_d\wxmsw28ud_adv_vc_custo
m.dll
*** ERROR: Symbol file could not be found.  Defaulted to export symbols
for C:\w
xTest004_d\wxmsw28ud_adv_vc_custom.dll -
0012f96c 00f30007 00a1c5bc ffffffff ffffffff
wxbase28ud_vc_custom!wxEventTableEn
try__wxEventTableEntry+0x26
*** ERROR: Symbol file could not be found.  Defaulted to export symbols
for C:\w
xTest004_d\MSVCR71D.dll -
0012f98c 10201d48 0012f9a4 00f25273 00f8d128
wxmsw28ud_adv_vc_custom!wxWizardEve
nt__wxWizardEvent+0xded7
0012f994 00f25273 00f8d128 00f8d2e0 0012f9f0 MSVCR71D!initterm+0x18
0012f9a4 00f2538a 00eb0000 00000001 0012fd30
wxmsw28ud_adv_vc_custom!wxWizardEve
nt__wxWizardEvent+0x3143
*** ERROR: Symbol file could not be found.  Defaulted to export symbols
for ntdl
l.dll -
0012f9f0 7c9011a7 00eb0000 00000001 0012fd30
wxmsw28ud_adv_vc_custom!wxWizardEve
nt__wxWizardEvent+0x325a
0012fa10 7c91cbab 00f252f0 00eb0000 00000001 ntdll!LdrInitializeThunk+0x29
0012fb18 7c92173e 0012fd30 7ffde000 7ffdf000
ntdll!LdrFindResourceDirectory_U+0x
276
0012fc94 7c921639 0012fd30 7c900000 0012fce0
ntdll!RtlLookupElementGenericTable+
0x185
0012fd1c 7c90eac7 0012fd30 7c900000 00000000
ntdll!RtlLookupElementGenericTable+
0x80
00000000 00000000 00000000 00000000 00000000 ntdll!KiUserApcDispatcher+0x7
0:000>
#include "wx/wx.h"

#include <wxlua/include/wxlstate.h>

extern bool wxLuaBinding_wxlua_init();       // modules/wxlua
extern bool wxLuaBinding_wx_init();

class MyApp: public wxApp
{
        virtual bool OnInit();
};

class MyFrame: public wxFrame
{
public:
        MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);

        void OnQuit(wxCommandEvent& event);
        void OnAbout(wxCommandEvent& event);
        void OnRun(wxCommandEvent& event);

        wxLuaState m_luaState;

        DECLARE_EVENT_TABLE()
};

enum
{
        ID_Quit = 1,
        ID_About,
        ID_Run,
};

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
        EVT_MENU(ID_Quit, MyFrame::OnQuit)
        EVT_MENU(ID_About, MyFrame::OnAbout)
        EVT_MENU(ID_Run, MyFrame::OnRun)
END_EVENT_TABLE()

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
        // Register the wxLua binding with the wxLuaState
        // (must be done before a wxLuaState is created)
//      wxLuaBinding_wxlua_init();
        wxLuaBinding_wx_init();

        MyFrame *frame = new MyFrame( _T("Hello World"), wxPoint(50,50), 
wxSize(450,340) );
        frame->Show(TRUE);
        SetTopWindow(frame);
        return TRUE;
} 

MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
        : wxFrame((wxFrame *)NULL, -1, title, pos, size)
        , m_luaState(this)
{
        wxMenu *menuFile = new wxMenu;

        menuFile->Append( ID_Run, _T("&Run") );
        menuFile->Append( ID_About, _T("&About...") );
        menuFile->AppendSeparator();
        menuFile->Append( ID_Quit, _T("E&xit") );

        wxMenuBar *menuBar = new wxMenuBar;
        menuBar->Append( menuFile, _T("&File") );

        SetMenuBar( menuBar );

        CreateStatusBar();
        SetStatusText( _T("Welcome to wxWidgets!") );
}

void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
        Close(TRUE);
}

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
        wxMessageBox(   _T("This is a wxWidgets Hello world sample"),
                                        _T("About Hello World"),
                                        wxOK | wxICON_INFORMATION,
                                        this );
}

void MyFrame::OnRun(wxCommandEvent& WXUNUSED(event))
{
        int res = m_luaState.RunFile(_T("test.lua"));
        if(res != 0)
                wxMessageBox(wxString::Format(_T("Returned %d"), res), 
_T("test.lua"));
}
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to