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

luaopen_wx error with wxGenericDirCtrl #84

Closed
decuant opened this issue Dec 17, 2020 · 6 comments
Closed

luaopen_wx error with wxGenericDirCtrl #84

decuant opened this issue Dec 17, 2020 · 6 comments
Assignees

Comments

@decuant
Copy link

decuant commented Dec 17, 2020

Hi Paul,

months ago people at wxWidgets fixed a problem in the DirCtrl that was causing an assert if an external USB drive was attached to my laptop.

Now I got it again, so I asked them for help and I run their Widgets samples (DirCtrl). But I got no assert at all.

If I run the application with this combination lua 5.4.2 + wxWidgets 3.0.1.4 + wxLua 3.1.0.0, then I get the assert again.

wxWidgets pops up a dialog where "luaopen_wx" is repeated 21 times, and nothing more.

-- ----------------------------------------------------------------------------
-- file filter for dir list control
--
local m_FileFilter =
	[[WMO site datasets|*.json|
	Compiled datasets|*.dat|
	All files except hidden|*.*]]


-- controls
--
local shSash = wx.wxSplitterWindow( frame, wx.wxID_ANY,
					              wx.wxDefaultPosition, wx.wxDefaultSize,
					              wx.wxSW_3D | wx.wxSP_PERMIT_UNSPLIT)

local lsDir = wx.wxGenericDirCtrl(shSash, wx.wxID_ANY, "File selector",
							wx.wxDefaultPosition, wx.wxDefaultSize,
							wx.wxDIRCTRL_3D_INTERNAL | wx.wxDIRCTRL_SHOW_FILTERS,
							m_FileFilter)

The problem rises when I select a different filter from the combo box.

I don't know what to do to provide you some insight, but I can help with testing.

Ciao

Antonio

@pkulchenko pkulchenko self-assigned this Dec 17, 2020
@pkulchenko
Copy link
Owner

@decuant, I'm a bit confused, as you are writing that the change was only applied several months ago, but are listing v3.0.1.4 of wxwidgets. Was the change backported to v3.0.1?

Also, can you include the screenshot of the assert you are getting and a minimal example that you are using (do you just put wxGenericDirCtrl on a form and show it)?

Do you get the assert in a non-debug build as well?

@decuant
Copy link
Author

decuant commented Dec 17, 2020

Hi Paul,

I have the screenshot so I can easily give it to you.

I just set Visual Studio to build a Release version, thus the assert statement is always there.

Now it's me confused, I have cloned wxLua and wxWidgets from both main branches few days ago.

trace

I will try to write the minimum example tomorrow.

Thank you for the feedback

@pkulchenko
Copy link
Owner

It looks like something is calling GetItemParam method on a tree node that is not a valid node, which is protected by the check wxCHECK_MSG( item.IsOk(), NULL, wxT("invalid tree item") );. It's a wxwidgets assertion that wxlua doesn't have any control over. You'll have to check why this is triggered and report this issue to the wxwidgets team.

I'm not sure how/why it works with their sample, but if you reproduce the same logic as implemented in the same using wxlua calls, I'd expect it to work in exactly the same way (which is why I think having a minimal sample will be useful).

@decuant
Copy link
Author

decuant commented Dec 18, 2020

Hi Paul,

yes, I understand your point. The ticket at wxWidgets I mentioned is here: https://trac.wxwidgets.org/ticket/18799

Just that before the problem was in another cpp source file.

This is a very short example:


--[[
*	testErr.lua
*
*   Testing the dirctrl widget.
]]

local wx = require("wx")

-- ----------------------------------------------------------------------------
-- file filter for dir list control
--
local m_FileFilter =
	[[WMO site datasets|*.json|
	Compiled datasets|*.dat|
	All files except hidden|*.*]]

-- ----------------------------------------------------------------------------
--
local function CreateFrame()

	-- create the frame
	--
	local frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "Test App",
							 wx.wxPoint(100, 100), 
							 wx.wxSize(600, 600))
						
						
	local lsDir = wx.wxGenericDirCtrl(frame, wx.wxID_ANY, "File selector",
									  wx.wxDefaultPosition, wx.wxDefaultSize,
									  wx.wxDIRCTRL_3D_INTERNAL | wx.wxDIRCTRL_SHOW_FILTERS,
									  m_FileFilter)
								

	return frame
end

-- ----------------------------------------------------------------------------
--
local function RunTest()
	
	local hWindow = CreateFrame()
	
	hWindow:Show(true)
	
	wx.wxGetApp():SetTopWindow(hWindow)
	wx.wxGetApp():MainLoop()	
	
end

-- ----------------------------------------------------------------------------
--

RunTest()

-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------

@decuant
Copy link
Author

decuant commented Dec 18, 2020

Hi Paul,

I built a debug version of both wxWidgets and wxLua and I run the test script via wxLua.exe.

Now I get the error even if the USB drive is not attached.

This looks a better stack trace, I'm attaching the screen capture.

trace2

@pkulchenko
Copy link
Owner

This looks like a wxwidgets issue (similar to the one that was fixed in the ticket) and not something that wxlua can address.

You just need to make sure you use the version of wxwidgets with the fix. You seem to be using 3.1.4, but given the timing of the fix, you need to use the current master (which should be 3.1.5), otherwise you don't get the fix that was applied in 18799.

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