Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using wxLocale causes a crash #38

Open
AntiBlueQuirk opened this issue Oct 23, 2017 · 2 comments
Open

Using wxLocale causes a crash #38

AntiBlueQuirk opened this issue Oct 23, 2017 · 2 comments

Comments

@AntiBlueQuirk
Copy link

Using wxLocale features seems to cause problems. wxWidgets fails while it is calling wxLocale::GetInfo(int, int), or if you call it manually. (The attached program shows the second case.) Since wxWidgets calls this all over the place, the program quickly crashes if you do anything significant after initializing a wxLocale object.

The following error is thrown from wxWidgets during the call:

../../src/common/intl.cpp(1546): assert "wxString::Format("%.3f", 1.23).find(str) != wxString::npos" failed in GetInfoFromLCID(): Decimal separator mismatch -- did you use setlocale()?If so, use wxLocale to change the locale instead.

To be perfectly honest, I'm not actually sure if this is a problem in wxWidgets, wxGo, or some weird interaction between them and Go. I traced through the program in gdb, and nothing seems to call setlocale() directly after initializing the wxLocale, but I'm not very sure.

Here is an example backtrace from a crash while creating a bitmap (I tried to clean it up a little.):

//Native backtrace
0x00000000016b3c3d in wxOnAssert(char const*, int, char const*, char const*, char const*) ()
0x000000000170fe52 in (anonymous namespace)::GetInfoFromLCID(unsigned long, wxLocaleInfo, wxLocaleCategory) ()
0x0000000001712e47 in wxLocale::GetInfo(wxLocaleInfo, wxLocaleCategory) ()
0x000000000173699f in wxString::FromCDouble(double, int) ()
0x00000000019c08e9 in wxPNGHandler::LoadFile(wxImage*, wxInputStream&, bool, int) ()
0x00000000019aa2f3 in wxImage::DoLoad(wxImageHandler&, wxInputStream&, int) ()
0x00000000019acb58 in wxImage::LoadFile(wxInputStream&, wxBitmapType, int) ()
0x0000000001916352 in (anonymous namespace)::wxTangoArtProvider::CreateBitmap(wxString const&, wxString const&, wxSize const&) ()
0x0000000001912ab5 in wxArtProvider::GetBitmap(wxString const&, wxString const&, wxSize const&) ()
0x0000000001687426 in _wrap_ArtProvider_GetBitmap__SWIG_2_wx_d5626d6e57cb98ce (_swig_go_0=...) at wx_wrap_windows.cxx:167403
0x0000000001409c3d in _cgo_a6fcac6c7ab6_Cfunc__wrap_ArtProvider_GetBitmap__SWIG_2_wx_d5626d6e57cb98ce (v=0xc0420819d8) at cgo-gcc-prolog:4626
0x0000000000457aa3 in runtime.asmcgocall ()

//Go backtrace
runtime.asmcgocall () at C:/Go/src/runtime/asm_amd64.s:610
0x0000000000402b62 in runtime.cgocall (
fn=0x1409c10 <_cgo_a6fcac6c7ab6_Cfunc__wrap_ArtProvider_GetBitmap__SWIG_2_wx_d5626d6e57cb98ce>, arg=0xc0420819d8, ~r2=6795318)
at C:/Go/src/runtime/cgocall.go:133
0x00000000004ac485 in github.com/dontpanic92/wxGo/wx._Cfunc__wrap_ArtProvider_GetBitmap__SWIG_2_wx_d5626d6e57cb98ce (p0=..., r1=0)
at github.com/dontpanic92/wxGo/wx/_obj/_cgo_gotypes.go:12874
0x00000000006a6a0f in github.com/dontpanic92/wxGo/wx.ArtProviderGetBitmap__SWIG_2 (arg1="wxART_MISSING_IMAGE", _swig_ret=...)
at github.com/dontpanic92/wxGo/wx/wx_windows.go:215402
0x00000000006a6b44 in github.com/dontpanic92/wxGo/wx.ArtProviderGetBitmap
(a= []interface {} = {...}, ~r1=...)
at github.com/dontpanic92/wxGo/wx/wx_windows.go:215413
0x0000000000b2bca7 in main.NewAuiToolBarFile (parent=..., ~r1=0x1)

My environment is Windows 10, with wxGo compiled with a Windows native Go installation, and GCC from MSYS2 MinGW. Everything else I've tried up to this point has worked fine.

(The attached program is named .txt so GitHub will accept the upload.)
wxLocaleTest.go.txt

@AntiBlueQuirk
Copy link
Author

Has the referenced commit fixed this issue?

@dontpanic92
Copy link
Owner

dontpanic92 commented Sep 21, 2018

I think it should, and I forgot to close this issue... Not very confident though.

This issue was actually reported to wxWidgets by someone but that ticket is closed as Not Repro. Think over again I decide to change my machine to en-us locale and then rebuild wxWidgets. I remember that it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants