Ticket #14856 (new defect)

Opened 6 months ago

Last modified 6 months ago

Streamline wxALWAYS_SHOW_SB handling in wxScrolled::Create()

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

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

Changed 6 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

Changed 6 months ago by SC

(In [73041]) workaround, see #14856

Changed 6 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.