RichTextCtrl crashes when the vertical tool bar is disabled and input text row exceeds the control height (Issue #23763)

16 views
Skip to first unread message

pythonaddict

unread,
Aug 11, 2023, 3:14:46 PM8/11/23
to wx-...@googlegroups.com, Subscribed

I use Windows 10, python 3.11.4, wxpython 4.2.1.

The program crashes when you type something in RichTextCtrl, if you disable the vertical scroll bar of RichTextCtrl and set the widget height to 28.

If you set the widget height to 30, however, it doesn’t crash.
Or, if you set the height to 28 and enable the vertical scroll bar, it doesn’t crash either.

import wx
import wx.richtext as rt

class MyFrame(wx.Frame):

    def __init__(self, parent):

        wx.Frame.__init__(self, parent, -1, "RichText")

        self.panel = wx.Panel(self)
        widget_height = 28
        self.rt = rt.RichTextCtrl(self.panel, -1, size=(200, widget_height))
        self.rt.EnableVerticalScrollbar(False)


        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rt, 0, wx.ALIGN_CENTER | wx.ALL, 20)

        self.panel.SetSizer(sizer)
        sizer.Layout()


app = wx.App(0)
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23763@github.com>

oneeyeman1

unread,
Aug 11, 2023, 4:03:53 PM8/11/23
to wx-...@googlegroups.com, Subscribed

@pythonaddict ,

What is the stack trace at the time of the crash?

Can you reproduce it in the C++ (richtext) sample?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23763/1675304446@github.com>

pythonaddict

unread,
Aug 11, 2023, 4:14:16 PM8/11/23
to wx-...@googlegroups.com, Subscribed

@oneeyeman1 I'm sorry but I don't know how to code in C++.

If you know how to code in C++, just:

  1. create a RichTextCtrl,
  2. disable RichTextCtrl's verticle scrollbars,
  3. set RichTextCtrl's height to 20,
  4. set RichTextCtrl's text font size to 20
  5. run the app
  6. try to type something in the RichTextCtrl,
  7. it will crash.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23763/1675315389@github.com>

paulcor

unread,
Aug 12, 2023, 6:53:00 PM8/12/23
to wx-...@googlegroups.com, Subscribed

Can be reproduced with the following patch to the richtext sample. Click on the text, then press Ctrl-End.

diff --git a/samples/richtext/richtext.cpp b/samples/richtext/richtext.cpp
index 5b53ee47c6..82a411c651 100644
--- a/samples/richtext/richtext.cpp
+++ b/samples/richtext/richtext.cpp
@@ -929,6 +929,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
     sizer->Add(splitter, 1, wxEXPAND);
 
     m_richTextCtrl = new MyRichTextCtrl(splitter, ID_RICHTEXT_CTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxVSCROLL|wxHSCROLL/*|wxWANTS_CHARS*/);
+    m_richTextCtrl->EnableVerticalScrollbar(false);
     wxASSERT(!m_richTextCtrl->GetBuffer().GetAttributes().HasFontPixelSize());
 
     wxFont font(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23763/1676134096@github.com>

paulcor

unread,
Nov 23, 2023, 11:35:29 AM11/23/23
to wx-...@googlegroups.com, Subscribed

Closed #23763 as completed.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/23763/issue_event/11049570545@github.com>

Reply all
Reply to author
Forward
0 new messages