Opened 21 months ago

Last modified 21 months ago

#14856 new defect

Streamline wxALWAYS_SHOW_SB handling in wxScrolled::Create()

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

Description

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" ?
http://trac.wxwidgets.org/changeset/72621
http://trac.wxwidgets.org/ticket/13616

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,

  • wxSUNKEN_BORDER )

+ wxSUNKEN_BORDER | wxALWAYS_SHOW_SB )

{

m_text = (wxChar *)NULL;

Change History (3)

comment:1 Changed 21 months 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 21 months ago by SC

(In [73041]) workaround, see #14856

comment:3 Changed 21 months 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.