gtk scroll assertion dialog box on app open
-
- In need of some credit
- Posts: 5
- Joined: Wed Oct 07, 2015 7:57 pm
gtk scroll assertion dialog box on app open
Hi, I've recently ported my project (lisaem) to the Raspbery Pi on Raspbian.
I've built both an old copy of 2.9.5 (I know, not stable), and also the latest stable 3.0.3 and both generate this error:
"../src/gtk/scrolwin.cpp(205): assert "scrolled" failed in DoShowScrollbars(): window must be created"
I'm guessing it means that a scroll widget might be instantiated before a window has been created?
Has anyone dealt with this before? Anything in particular I should change in my code to to prevent this from coming up?
Thanks.
I've built both an old copy of 2.9.5 (I know, not stable), and also the latest stable 3.0.3 and both generate this error:
"../src/gtk/scrolwin.cpp(205): assert "scrolled" failed in DoShowScrollbars(): window must be created"
I'm guessing it means that a scroll widget might be instantiated before a window has been created?
Has anyone dealt with this before? Anything in particular I should change in my code to to prevent this from coming up?
Thanks.
Re: gtk scroll assertion dialog box on app open
So are you saying that the same code worked fine on another platform?I've recently ported my project (lisaem) to the Raspbery Pi on Raspbian.
It means that somewhere, someone is trying to set the scrollbars before the window is fully created. But without seeing code it's hard to say more. Is there anything special regarding the particular window that causes this assert?"../src/gtk/scrolwin.cpp(205): assert "scrolled" failed in DoShowScrollbars(): window must be created"
I'm guessing it means that a scroll widget might be instantiated before a window has been created?
Use the source, Luke!
-
- In need of some credit
- Posts: 5
- Joined: Wed Oct 07, 2015 7:57 pm
Re: gtk scroll assertion dialog box on app open
Yes, exactly, the same code works on OS X and Windows without that message.
Code is here: https://github.com/rayarachelian/lisaem ... aem_wx.cpp
Code is here: https://github.com/rayarachelian/lisaem ... aem_wx.cpp
Re: gtk scroll assertion dialog box on app open
That's a little too much code to look through. I did a text search for scroll related things, but nothing caught my eye. So we'll need at least a backtrace to see which call in your code triggers the assert.
Use the source, Luke!
-
- In need of some credit
- Posts: 5
- Joined: Wed Oct 07, 2015 7:57 pm
Re: gtk scroll assertion dialog box on app open
This is the backtrace from Linux with wx3.0.2:
ASSERT INFO:
../src/gtk/scrolwin.cpp(205): assert "scrolled" failed in DoShowScrollbars(): window must be created
BACKTRACE:
[1] wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility, wxScrollbarVisibility) /home/ray/wxWidgets-3.0.2/build-gtk/../src/gtk/scrolwin.cpp:205
[2] wxScrolled<wxPanel>::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&) /usr/local/wx3.0.2-gtk/include/wx-3.0/wx/scrolwin.h:427
[3] LisaEmFrame::LisaEmFrame(wxString const&) /home/ray/lisaem-1.2.6.2/wxui/lisaem_wx.cpp:5138
[4] LisaEmApp::OnInit() /home/ray/lisaem-1.2.6.2/wxui/lisaem_wx.cpp:1774
[5] wxEntry(int&, wchar_t**) /home/ray/wxWidgets-3.0.2/build-gtk/../src/common/init.cpp:479
[6] wxEntry(int&, char**) /home/ray/wxWidgets-3.0.2/build-gtk/../src/common/init.cpp:508
[7] main /home/ray/lisaem-1.2.6.2/wxui/lisaem_wx.cpp:1725
[8] __libc_start_main
[9] _start
5138 if (!my_lisawin) my_lisawin = new LisaWin(this);
and the LisaWin class extends wxScrolledWindow:
271 class LisaWin : public wxScrolledWindow
ASSERT INFO:
../src/gtk/scrolwin.cpp(205): assert "scrolled" failed in DoShowScrollbars(): window must be created
BACKTRACE:
[1] wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility, wxScrollbarVisibility) /home/ray/wxWidgets-3.0.2/build-gtk/../src/gtk/scrolwin.cpp:205
[2] wxScrolled<wxPanel>::Create(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&) /usr/local/wx3.0.2-gtk/include/wx-3.0/wx/scrolwin.h:427
[3] LisaEmFrame::LisaEmFrame(wxString const&) /home/ray/lisaem-1.2.6.2/wxui/lisaem_wx.cpp:5138
[4] LisaEmApp::OnInit() /home/ray/lisaem-1.2.6.2/wxui/lisaem_wx.cpp:1774
[5] wxEntry(int&, wchar_t**) /home/ray/wxWidgets-3.0.2/build-gtk/../src/common/init.cpp:479
[6] wxEntry(int&, char**) /home/ray/wxWidgets-3.0.2/build-gtk/../src/common/init.cpp:508
[7] main /home/ray/lisaem-1.2.6.2/wxui/lisaem_wx.cpp:1725
[8] __libc_start_main
[9] _start
5138 if (!my_lisawin) my_lisawin = new LisaWin(this);
and the LisaWin class extends wxScrolledWindow:
271 class LisaWin : public wxScrolledWindow
Re: gtk scroll assertion dialog box on app open
Sorry, i have no explanation for this.
Things you can try now:
- check if any of the wxWidgets samples shows the same problem
- if not, try to create a minimal compilable sample that creates the assert
- single-step through the LisaWin ctor and check what's going wrong
Things you can try now:
- check if any of the wxWidgets samples shows the same problem
- if not, try to create a minimal compilable sample that creates the assert
- single-step through the LisaWin ctor and check what's going wrong
Use the source, Luke!
-
- In need of some credit
- Posts: 5
- Joined: Wed Oct 07, 2015 7:57 pm
Re: gtk scroll assertion dialog box on app open
Will do.
I did find this, which might be related: https://lists.launchpad.net/kicad-devel ... 17114.html
But, D'oh! I found the problem, I had been compiling wxWidgets with debug enabled from when I was trying to capture all the errors and warnings in my own code to get hints as to what code to fix.
Disabling it in the configure step gets rid of the message and all is good.
There's still a question as to why gtk complains about scrollable windows, but that's less important.
I did find this, which might be related: https://lists.launchpad.net/kicad-devel ... 17114.html
But, D'oh! I found the problem, I had been compiling wxWidgets with debug enabled from when I was trying to capture all the errors and warnings in my own code to get hints as to what code to fix.
Disabling it in the configure step gets rid of the message and all is good.
There's still a question as to why gtk complains about scrollable windows, but that's less important.
Re: gtk scroll assertion dialog box on app open
Yes, that sounds like the same problem. The solution seems to be to not set the wxALWAYS_SHOW_SB flag.I did find this, which might be related: https://lists.launchpad.net/kicad-devel ... 17114.html
Not really, you just silenced the assert. The problem is still there.Disabling it in the configure step gets rid of the message and all is good.
Use the source, Luke!
-
- In need of some credit
- Posts: 5
- Joined: Wed Oct 07, 2015 7:57 pm
Re: gtk scroll assertion dialog box on app open
Well yes, but now I can work on turning this into a .deb package.
Re: gtk scroll assertion dialog box on app open
This is the code that triggers the ASSERT: Apparently, the macro is returning a null pointer. The message is very unclear because this code is called from somewhere in the window creation code, so the "window must be created" message isn't helpful. If anything, I would patch the code to return rather than ignore the null pointer.
Gdb tells me that this is called from somewhere in a chain from generic/grid.cpp: I don't understand the second Create(); is that wxGrid:Create() or wxScrolledWindow::Create()? In either case I don't see any documentation of Create() with no parameters.
The problem seems to be with wxALWAYS_SHOW_SB. It appears this is not allowed in wxGTK, but the documentation doesn't say this, so it is at least a documentation bug.
I'm annoyed too. With the help of doublemax, I have my application running great on Windows and, like you, it appears to work on Linux except to the annoying ASSET message. I'd hate to have to run it under WINE instead of natively.
Code: Select all
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
wxScrollbarVisibility vert)
{
GtkScrolledWindow * const scrolled = GTK_SCROLLED_WINDOW(m_win->m_widget);
wxCHECK_RET( scrolled, "window must be created" );
gtk_scrolled_window_set_policy(scrolled,
GtkPolicyFromWX(horz),
GtkPolicyFromWX(vert));
}
Gdb tells me that this is called from somewhere in a chain from generic/grid.cpp:
Code: Select all
bool wxGrid::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
{
if (!wxScrolledWindow::Create(parent, id, pos, size,
style | wxWANTS_CHARS, name))
return false;
m_colMinWidths = wxLongToLongHashMap(GRID_HASH_SIZE);
m_rowMinHeights = wxLongToLongHashMap(GRID_HASH_SIZE);
Create();
SetInitialSize(size);
CalcDimensions();
return true;
}
The problem seems to be with wxALWAYS_SHOW_SB. It appears this is not allowed in wxGTK, but the documentation doesn't say this, so it is at least a documentation bug.
I'm annoyed too. With the help of doublemax, I have my application running great on Windows and, like you, it appears to work on Linux except to the annoying ASSET message. I'd hate to have to run it under WINE instead of natively.
Re: gtk scroll assertion dialog box on app open
wxCHECK_RET is defined here: http://docs.wxwidgets.org/trunk/group__ ... 6b434fd0bd
It says that the check is made and returns if the condition is false, so rather than just comment it out, you should replace it with something like:
It says that the check is made and returns if the condition is false, so rather than just comment it out, you should replace it with something like:
Code: Select all
if (!scrolled) return;
Re: gtk scroll assertion dialog box on app open
FOUND THE BUG!
In /include/wx/scrollwin.h near line 425, the present code is:
This should be changed to: because this code works on Windows but not Linux or OSX.
At the least it should be:
I have no idea where to submit this bug report.
In /include/wx/scrollwin.h near line 425, the present code is:
Code: Select all
#ifdef __WXOSX__
bool retval = T::Create(parent, winid, pos, size, style, name);
if ( retval && (style & wxALWAYS_SHOW_SB) )
ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
return retval;
#else
if ( style & wxALWAYS_SHOW_SB )
ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
return T::Create(parent, winid, pos, size, style, name);
#endif
Code: Select all
#ifndef __WXMSW__
bool retval = T::Create(parent, winid, pos, size, style, name);
if ( retval && (style & wxALWAYS_SHOW_SB) )
ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
return retval;
#else
if ( style & wxALWAYS_SHOW_SB )
ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
return T::Create(parent, winid, pos, size, style, name);
#endif
At the least it should be:
Code: Select all
#if defined(__WXOSX__) || defined(__WXGTK__)
bool retval = T::Create(parent, winid, pos, size, style, name);
if ( retval && (style & wxALWAYS_SHOW_SB) )
ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
return retval;
#else
if ( style & wxALWAYS_SHOW_SB )
ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS);
return T::Create(parent, winid, pos, size, style, name);
#endif
Re: gtk scroll assertion dialog box on app open
http://trac.wxwidgets.org/I have no idea where to submit this bug report.
Use the source, Luke!