wxPropertyGrid + Hide/Unhide item results in drawing errors and crashes (Issue #22428)

56 views
Skip to first unread message

Mr.T

unread,
May 15, 2022, 5:55:26 PM5/15/22
to wx-...@googlegroups.com, Subscribed

Describe the bug
If a property-grid contains a wxEnumProperty (e.q. values hide + unhide) and following other properties that are hidden or shown by this enum-property and the scroll-area is moved to the last possible position before, than a hide of just 1 property results in the enum-property is drawn at wrong position. And also the application crash some time later (sometimes), because of detached property.

Expected vs observed behaviour
No painting errors, no crashes when porperties hidden and shown again.

Patch or snippet allowing to reproduce the problem

1
2
3

To Reproduce
Steps to reproduce the behaviour, please make them as detailed as possible, e.g.

  1. Ceate an application that uses wxAuiManager
  2. Create a wxPropertyGrid and put it in a frame of aui
  3. Add properties before
  4. Add a enum-property that enabled hide/unhide the next property
  5. Add some properties after that
  6. start application and ensure the window-size of the wxAui-Frame is to small to show everything
  7. scroll down until last possible position
  8. click on the enum-property and select a value that hide a property after the enum-property
  9. the enum-property is drawn at wrong position and the app crashes some time

Platform and version information

  • wxWidgets version you use: 3.1.5
  • wxWidgets port you use: wxGTK (can't reproduce it with MSW)
  • OS and its version: Ubuntu 20.04
  • For wxGTK only:
    • GTK version: 3.24.20
    • Which GDK backend is used: X11


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/22428@github.com>

AW

unread,
May 17, 2022, 5:01:33 PM5/17/22
to wx-...@googlegroups.com, Subscribed

I cannot reproduce this issue with below sample app. On Ubuntu 20.04 (GTK 3.24.20) and Debian 11 (GTK 3.24.24) wxEnumProperty is positioned as expected and there are no crashes.
Could you check if it works for you?

#include <wx/wx.h>
#include <wx/aui/aui.h>
#include <wx/propgrid/propgrid.h>
#include <wx/propgrid/manager.h>

class FormMain : public wxFrame
{
public:
    FormMain();
    ~FormMain();

private:
    wxAuiManager m_auiManager;
};

class cxApplication : public wxApp
{
public:

    virtual bool OnInit() wxOVERRIDE
    {
        FormMain* frame = new FormMain();
        frame->Show(true);
        return true;
    }
};

wxIMPLEMENT_APP(cxApplication);

FormMain::FormMain() : wxFrame(NULL, wxID_ANY, "Sample", wxDefaultPosition, wxSize(600, 400))
{
    m_auiManager.SetManagedWindow(this);

    wxPropertyGridManager* pgman = new wxPropertyGridManager(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_TOOLTIPS | wxPG_TOOLBAR);
    wxPropertyGridPage* pg = pgman->AddPage("Page");

    for (int i = 0; i < 9; i++)
    {
        pg->Append(new wxIntProperty(wxString::Format("Property %d", i), wxPG_LABEL, i));
    }

    wxPGChoices sel;
    sel.Add("Item 1", 10);
    sel.Add("Item 2", 20);
    sel.Add("Item 3", 30);
    sel.Add("Item 4", 40);
    sel.Add("Item 5", 50);
    pg->Append(new wxEnumProperty("EnumProperty", wxPG_LABEL, sel, 10));

    for (int i = 9; i < 15; i++)
    {
        pg->Append(new wxIntProperty(wxString::Format("Property %d", i), wxPG_LABEL, i));
    }

    m_auiManager.AddPane(pgman, wxAuiPaneInfo().Center().Caption("Property Grid").
            CloseButton(false).MinSize(wxSize(200,200)));
    m_auiManager.Update();
}

FormMain::~FormMain()
{
}


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/22428/1129313442@github.com>

Mr.T

unread,
May 17, 2022, 6:38:14 PM5/17/22
to wx-...@googlegroups.com, Subscribed

Maybe a combination of some things (e.q.: windows-size, status-bar enabled, clear-call on page-properties before).

Here is a test application that contains the buggy behaviour:

PropGridBug.zip

Here a video, what happens:

PropGridBug

OffTopic:
Seems like, there is also some other bug with a message "Cannot obtain display info for detached property"(https://forums.wxwidgets.org/viewtopic.php?f=1&t=49258). Don't know what this is, it happens seldom, but kills the app. In my opinion some synchronization issue, but can't reproduce this and it's very problematical. But maybe the same origin.


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/22428/1129389410@github.com>

AW

unread,
May 18, 2022, 1:53:39 PM5/18/22
to wx-...@googlegroups.com, Subscribed

I cannot reproduce the issue with your code - positioning is OK, no crashes.
BTW, you call in your sample code wxPropertyGridPageState::DoClear() method but wxPropertyGridPageState documentation says Generally you should not use this class directly, but instead member functions in wxPropertyGridInterface, wxPropertyGrid, wxPropertyGridPage, and wxPropertyGridManager.
So, you should call wxPropertyGridPage::Clear() instead.
Please also note that DoSomething() methods are generally for internal purposes only and they are publicly exposed only due to the technical reasons.


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/22428/1130316848@github.com>

Mr.T

unread,
May 19, 2022, 7:55:28 AM5/19/22
to wx-...@googlegroups.com, Subscribed

  • Don't get any messages onto console.
  • changed DoClear into Clear, bug still there and exists.

DoSomething(): don't know this, thanks for the hint, but in my opinion not very meaningful to make such things public and if not possible otherwise to name such things for example 'Internal' (or somehing equivalent) that is visible to none-widget developer without reading the whole manual.


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/22428/1131594760@github.com>

Mr.T

unread,
May 19, 2022, 7:56:13 AM5/19/22
to wx-...@googlegroups.com, Subscribed

How can I support you to find/fix the bug?


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/22428/1131595377@github.com>

AW

unread,
May 21, 2022, 4:58:41 PM5/21/22
to wx-...@googlegroups.com, Subscribed

Eventually I've managed to reproduce the issue with positioning - thanks for the hints.
Please check with current master if it's fixed now.


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/22428/1133767483@github.com>

AW

unread,
May 27, 2022, 1:14:34 PM5/27/22
to wx-...@googlegroups.com, Subscribed

Closed #22428 as completed via 92d7176.


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/22428/issue_event/6694029155@github.com>

Reply all
Reply to author
Forward
0 new messages