Opened 5 years ago

Last modified 5 years ago

#14856 new defect

Streamline wxALWAYS_SHOW_SB handling in wxScrolled::Create()

Reported by: Mdx4 Owned by:
Priority: low Milestone:
Component: wxOSX Version: stable-latest
Keywords: wxScrolledWindow wxALWAYS_SHOW_SB Cc:
Blocked By: Blocking:
Patch: no


If you use wxScrolledWindow with the wxALWAYS_SHOW_SB flag this leads to crash in initialization.

Probably could be related with "wxScrolled<> does not disable scrollbars when wxALWAYS_SHOW_SB is used" ?

GetClientSize is called too early and GetPeer() returns NULL.

How to reproduce it:

Index: samples/caret/caret.cpp
--- samples/caret/caret.cpp (revision 73027)
+++ samples/caret/caret.cpp (working copy)
@@ -306,7 +306,7 @@

MyCanvas::MyCanvas( wxWindow *parent )

: wxScrolledWindow( parent, wxID_ANY,

wxDefaultPosition, wxDefaultSize,




m_text = (wxChar *)NULL;

Change History (3)

comment:1 Changed 5 years ago by csomor

  • Status changed from new to infoneeded_new

Vadim: can we just invert the order of Create and SetScrollbar ? I'll commit a fix for OSX but if it can be done for all platforms without issues, I'd favor that, I don't understand why MSW does not trigger either

comment:2 Changed 5 years ago by SC

(In [73041]) workaround, see #14856

comment:3 Changed 5 years ago by vadz

  • Priority changed from normal to low
  • Status changed from infoneeded_new to new
  • Summary changed from OSX: wxScrolledWindow & wxALWAYS_SHOW_SB leads to crash in constructor to Streamline wxALWAYS_SHOW_SB handling in wxScrolled::Create()

Actually, is ShowScrollbars() call needed at all? In wxGTK and wxMSW it almost surely isn't because wxWindow already respects wxALWAYS_SHOW_SB.

Note: See TracTickets for help on using tickets.