pkulchenko / wxlua

wxlua: Lua bindings for wxWidgets cross-platform GUI toolkit; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and wxWidgets 3.x
306 stars 59 forks source link

Crash when run lua.exe wxluasudoku.wx.lua. #38

Closed ValeryKV closed 5 years ago

ValeryKV commented 5 years ago

I built wxLua 3.0 with Lua 5.2, wxWidgets 2.9.5 under Windows XP. I ran samples with lua.exe. veryminimal.wx.lua and minimal.wx.lua work great. When I ran wxluasudoku.wx.lua, it crashes with the error: wxluasudoku.wx.lua:4901: attempt to call method 'CopyFromBitmap' (a nil value) wxluasudoku.wx.lua is started OK with wxLua 2.8.

wxcore_gdi.i contains the declaration of wxIcon: %wxchkver_3_0_0 void CopyFromBitmap(const wxBitmap& bmp);

Most probably that means that I have to use wxWidgets version 3.0 or above.

wxLua 2.8 was release on 2012, but last commit to wxLua 3.0 was done several days ago. That is why I chose wxLua 3.0 when I wanted to write my first app with wxWidgets and lua. I also want to use Lua 5.3 that wxLua 3.0 supports.

Does wxLua 3.0 compatible with wxWidgets 2.9?

pkulchenko commented 5 years ago

@ValeryKV, this should be fixed in the commit I just pushed, but 2.9.5 version is really old, so you should probably be using 3.0 or 3.1 versions.

ValeryKV commented 5 years ago

Now lua.exe wxluasudoku.wx.lua crashes at bmp:delete() in MItem function. I tried to comment some code, but I always got a crash somewhere. May be you should add a note that this wxLua version is not compatible with wxWidgets 2.x. But maybe the issue is in VC 6.0. Thank you for fixed bugs.

pkulchenko commented 5 years ago

I don't get any errors in the wxluasudoku example compiling with 2.9.5 on Windows (however I'm using mingw, as I don't have MSVC). It would be unusual to crash on "delete", as this function is wxlua-specific (not wxwidgets) and hasn't changed since wxlua 2.8.12.

wxlua is compatible with wxWidgets 2.x, but it doesn't implement all the functions exposed in the API and while I try to preserve backward compatibility, 2.9.5 was released 6 years ago and I didn't feel the need to retest on such an old release.

I've confirmed the current master compiling against wxwidgets 2.9.5, 3.0 and 3.1 versions.

ValeryKV commented 5 years ago

Yes, the issue is in VC 6.0 compiler in wxWidgets code. I filed a bug https://trac.wxwidgets.org/ticket/18453. Maybe they will decide to fix it.

pkulchenko commented 5 years ago

ok; thank you for the update. Nice analysis in the wxwidgets ticket!