Opened 3 months ago

Closed 5 weeks ago

#18211 closed defect (fixed)

wxPropertyGrid crash on Mojave

Reported by: dkulp Owned by:
Priority: normal Milestone:
Component: wxOSX Version: 3.1.1
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

On Mojave, the events for combo box/choice in a wxPropertyGrid are coming in a different order and is causing a crash in my application.

What's happening is when a user selects an option from the choice, we get the "changed" event where we may adjust other aspects of the grid depending on the option selected. On older version of OSX, the view for the drop down goes away prior to our adjusting things. However, on Mojave, it's getting an additional paint event after the changed event and with our adjustments, the selection may be different. This causes a crash.

A simple fix for my case is:

diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp
index 6d4fcbd8fa..0002c3380f 100644
--- a/src/propgrid/editors.cpp
+++ b/src/propgrid/editors.cpp
@@ -742,6 +742,8 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
                                        int flags )
 {
     wxPGProperty* p = GetSelection();
+    if (!p) return;
+
     wxString text;

     const wxPGChoices& choices = p->GetChoices();

Change History (20)

comment:1 Changed 5 weeks ago by awi

  • Status changed from new to infoneeded_new

Brief summary of the related PR #1008: It is not possible to reproduce the issue with proposed test case on wxMSW (Win 7 & 10), wxGTK (2 & 3), wxOSX (10.11 & 10.12) so it's likely it's indeed only Mojave-related problem.

I don't have access to Mojave so it would be helpful if you could check if this problem occurs in the simpler environment, like "minimal propgrid" sample. For instance, does the crash happen with such modifications?

  • samples/propgrid/propgrid_minimal.cpp

    diff --git a/samples/propgrid/propgrid_minimal.cpp b/samples/propgrid/propgrid_minimal.cpp
    a b MyFrame::MyFrame(wxWindow* parent) 
    5454    pg->Append( new wxStringProperty("String Property", wxPG_LABEL) );
    5555    pg->Append( new wxIntProperty("Int Property", wxPG_LABEL) );
    5656    pg->Append( new wxBoolProperty("Bool Property", wxPG_LABEL) );
     57    wxChar* labels[] = { wxS("One"), wxS("Two"), wxS("Three"), wxS("Four"), NULL };
     58    long values[] = { 1, 2, 3, 4 };
     59    pg->Append(new wxEnumProperty("EnumProperty", wxPG_LABEL, labels, values, 2));
    5760
    5861    SetSize(400, 600);
    5962}
    void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event) 
    7174    {
    7275        wxLogVerbose("OnPropertyGridChange(NULL)");
    7376    }
     77    m_pg->ClearSelection();
    7478}
    7579
    7680void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent &event)

comment:2 Changed 5 weeks ago by dkulp

  • Cc dan@… added
  • Status changed from infoneeded_new to new

Yes. That causes the same crash.

comment:3 Changed 5 weeks ago by awi

  • Status changed from new to infoneeded_new

Could you please check (with e.g. below patch to the sample) what is the sequence of events on Mojave when a new EnumProperty item is selected?
On Sierra it looks like this:

13:09:37: Debug: wxEVT_PAINT
13:09:37: Debug: Property selected: EnumProperty
13:09:37: Debug: wxEVT_PAINT
13:09:39: Debug: wxEVT_PAINT
13:09:39: Debug: wxEVT_COMBOBOX_DROPDOWN
13:09:39: Debug: wxEVT_PAINT
13:09:39: Debug: wxEVT_PAINT
13:09:42: Debug: wxEVT_COMBOBOX_CLOSEUP
13:09:42: Debug: OnPropertyGridChanging(EnumProperty)
13:09:42: Debug: OnPropertyGridChange(EnumProperty, value=Three)
13:09:42: Debug: wxEVT_COMBOBOX
  • samples/propgrid/propgrid.cpp

    diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp
    index b263532d09..efe11fd525 100644
    a b bool cxApplication::OnInit() 
    31463146    return true;
    31473147}
    31483148
     3149#include "wx/odcombo.h"
     3150
     3151int cxApplication::FilterEvent(wxEvent &evt)
     3152{
     3153    wxOwnerDrawnComboBox* cb = wxDynamicCast(evt.GetEventObject(), wxOwnerDrawnComboBox);
     3154    if ( cb )
     3155    {
     3156        wxEventType et = evt.GetEventType();
     3157        if ( et == wxEVT_COMBOBOX ) wxLogDebug("wxEVT_COMBOBOX");
     3158        else if ( et == wxEVT_COMBOBOX_DROPDOWN ) wxLogDebug("wxEVT_COMBOBOX_DROPDOWN");
     3159        else if ( et == wxEVT_COMBOBOX_CLOSEUP ) wxLogDebug("wxEVT_COMBOBOX_CLOSEUP");
     3160        else if ( et == wxEVT_PAINT ) wxLogDebug("wxEVT_PAINT");
     3161    }
     3162
     3163    return wxApp::FilterEvent(evt);
     3164}
     3165
    31493166// -----------------------------------------------------------------------
    31503167
    31513168void FormMain::OnIdle( wxIdleEvent& event )
  • samples/propgrid/propgrid.h

    diff --git a/samples/propgrid/propgrid.h b/samples/propgrid/propgrid.h
    a b class cxApplication : public wxApp 
    274274public:
    275275
    276276    virtual bool OnInit() wxOVERRIDE;
     277    int FilterEvent(wxEvent &evt) wxOVERRIDE;
    277278
    278279private:
    279280    FormMain    *Form1;
  • samples/propgrid/propgrid_minimal.cpp

    diff --git a/samples/propgrid/propgrid_minimal.cpp b/samples/propgrid/propgrid_minimal.cpp
    index ee9bbafe97..0aff9ffad5 100644
    a b public: 
    2020    void OnAction(wxCommandEvent& event);
    2121    void OnPropertyGridChange(wxPropertyGridEvent& event);
    2222    void OnPropertyGridChanging(wxPropertyGridEvent& event);
     23    void OnPropertyGridSelected(wxPropertyGridEvent& evt);
    2324
    2425private:
    2526    wxPropertyGrid* m_pg;
    MyFrame::MyFrame(wxWindow* parent) 
    5455    pg->Append( new wxStringProperty("String Property", wxPG_LABEL) );
    5556    pg->Append( new wxIntProperty("Int Property", wxPG_LABEL) );
    5657    pg->Append( new wxBoolProperty("Bool Property", wxPG_LABEL) );
     58    wxChar* labels[] = { wxS("One"), wxS("Two"), wxS("Three"), wxS("Four"), NULL };
     59    long values[] = { 1, 2, 3, 4 };
     60    pg->Append(new wxEnumProperty("EnumProperty", wxPG_LABEL, labels, values, 2));
     61
     62    pg->Bind(wxEVT_PG_SELECTED, &MyFrame::OnPropertyGridSelected, this);
    5763
    5864    SetSize(400, 600);
    5965}
    6066
     67void MyFrame::OnPropertyGridSelected(wxPropertyGridEvent& evt)
     68{
     69    wxPGProperty* p = evt.GetProperty();
     70    wxLogDebug("Property selected: %s", p->GetName());
     71}
     72
    6173void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event)
    6274{
    6375    wxPGProperty* p = event.GetProperty();
    6476
    6577    if ( p )
    6678    {
    67         wxLogVerbose("OnPropertyGridChange(%s, value=%s)",
     79        wxLogDebug("OnPropertyGridChange(%s, value=%s)",
    6880                   p->GetName(), p->GetValueAsString());
    6981    }
    7082    else
    7183    {
    72         wxLogVerbose("OnPropertyGridChange(NULL)");
     84        wxLogDebug("OnPropertyGridChange(NULL)");
    7385    }
     86    m_pg->ClearSelection();
    7487}
    7588
    7689void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent &event)
    7790{
    7891    wxPGProperty* p = event.GetProperty();
    7992
    80     wxLogVerbose("OnPropertyGridChanging(%s)", p->GetName());
     93    wxLogDebug("OnPropertyGridChanging(%s)", p->GetName());
    8194}
    8295
    8396void MyFrame::OnAction(wxCommandEvent &)

comment:4 Changed 5 weeks ago by dkulp

  • Cc dan@… removed
  • Status changed from infoneeded_new to new

With the ClearSelection, I get:

`
08:41:43 AM: Debug: Property selected: EnumProperty
08:41:43 AM: Debug: wxEVT_PAINT
08:41:44 AM: Debug: wxEVT_PAINT
08:41:44 AM: Debug: wxEVT_COMBOBOX_DROPDOWN
08:41:44 AM: Debug: wxEVT_PAINT
08:41:44 AM: Debug: wxEVT_PAINT
08:41:47 AM: Debug: wxEVT_COMBOBOX_CLOSEUP
08:41:47 AM: Debug: OnPropertyGridChanging(EnumProperty)
08:41:47 AM: Debug: OnPropertyGridChange(EnumProperty, value=Three)
08:41:47 AM: Debug: wxEVT_COMBOBOX
Segmentation fault: 11
`

If I remove that:
`
08:42:13 AM: Debug: Property selected: EnumProperty
08:42:13 AM: Debug: wxEVT_PAINT
08:42:13 AM: Debug: wxEVT_PAINT
08:42:14 AM: Debug: wxEVT_COMBOBOX_DROPDOWN
08:42:14 AM: Debug: wxEVT_PAINT
08:42:14 AM: Debug: wxEVT_PAINT
08:42:16 AM: Debug: wxEVT_COMBOBOX_CLOSEUP
08:42:16 AM: Debug: OnPropertyGridChanging(EnumProperty)
08:42:16 AM: Debug: OnPropertyGridChange(EnumProperty, value=Four)
08:42:16 AM: Debug: wxEVT_COMBOBOX
08:42:16 AM: Debug: wxEVT_PAINT
08:42:29 AM: Debug: wxEVT_PAINT
`

comment:5 Changed 5 weeks ago by awi

  • Status changed from new to infoneeded_new

So it seems we indeed have unwanted paint events for already closed popup.
It would be good to know what is the status of the combo box when these paint requests are executed. Could you check how it looks on Mojave with e.g. below patch?

  • samples/propgrid/propgrid.cpp

    diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp
    a b int cxApplication::FilterEvent(wxEvent &evt) 
    31573157        if ( et == wxEVT_COMBOBOX ) wxLogDebug("wxEVT_COMBOBOX");
    31583158        else if ( et == wxEVT_COMBOBOX_DROPDOWN ) wxLogDebug("wxEVT_COMBOBOX_DROPDOWN");
    31593159        else if ( et == wxEVT_COMBOBOX_CLOSEUP ) wxLogDebug("wxEVT_COMBOBOX_CLOSEUP");
    3160         else if ( et == wxEVT_PAINT ) wxLogDebug("wxEVT_PAINT");
     3160        else if ( et == wxEVT_PAINT )
     3161        {
     3162            wxRect r = cb->GetUpdateRegion().GetBox();
     3163            wxLogDebug("wxEVT_PAINT: %i,%i  %ix%i  CB shown: %c  CBP: %c  CBP shown: %c", r.x, r.y, r.width, r.height,
     3164                       cb->IsShownOnScreen()?'y':'n', cb->GetPopupControl()?'y':'n', cb->IsPopupShown()?'y':'n');
     3165        }
    31613166    }
    31623167
    31633168    return wxApp::FilterEvent(evt);

comment:6 Changed 5 weeks ago by dkulp

  • Cc dan@… added
  • Status changed from infoneeded_new to new

With the ClearSlection commented out:

05:12:28 PM: Debug: Property selected: EnumProperty
05:12:28 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: n
05:12:29 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: n
05:12:29 PM: Debug: wxEVT_COMBOBOX_DROPDOWN
05:12:29 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: y
05:12:29 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: y
05:12:30 PM: Debug: wxEVT_COMBOBOX_CLOSEUP
05:12:30 PM: Debug: OnPropertyGridChanging(EnumProperty)
05:12:30 PM: Debug: OnPropertyGridChange(EnumProperty, value=Four)
05:12:30 PM: Debug: wxEVT_COMBOBOX
05:12:30 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: n

With it:

05:10:23 PM: Debug: Property selected: EnumProperty
05:10:23 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: n
05:10:26 PM: Debug: wxEVT_COMBOBOX_DROPDOWN
05:10:26 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: y
05:10:26 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: y
05:10:33 PM: Debug: wxEVT_COMBOBOX_CLOSEUP
05:10:33 PM: Debug: OnPropertyGridChanging(EnumProperty)
05:10:33 PM: Debug: OnPropertyGridChange(EnumProperty, value=Four)
05:10:33 PM: Debug: wxEVT_COMBOBOX
Segmentation fault: 11

And here is the stack trace for the crash:

0   libwx_osx_cocoau_propgrid-3.1.dylib	0x0000000105f0333c wxPGChoices::IsOk() const + 12 (property.h:874)
1   libwx_osx_cocoau_propgrid-3.1.dylib	0x0000000105f142cc wxPropertyGrid::OnComboItemPaint(wxPGComboBox const*, int, wxDC*, wxRect&, int) + 124 (editors.cpp:750)
2   libwx_osx_cocoau_propgrid-3.1.dylib	0x0000000105f1b5c7 wxPGComboBox::OnMeasureItem(unsigned long) const + 87 (editors.cpp:684)
3   libwx_osx_cocoau_core-3.1.dylib	0x000000010653e2ee wxVListBoxComboPopup::OnMeasureItem(unsigned long) const + 174 (odcombo.cpp:168)
4   libwx_osx_cocoau_core-3.1.dylib	0x0000000106531266 wxVListBox::OnGetRowHeight(unsigned long) const + 54 (vlbox.cpp:382)
5   libwx_osx_cocoau_core-3.1.dylib	0x000000010652f383 wxVListBox::OnPaint(wxPaintEvent&) + 387 (vlbox.cpp:460)
6   libwx_baseu-3.1.dylib         	0x0000000106ec1166 wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const + 134 (appbase.cpp:658)
7   libwx_baseu-3.1.dylib         	0x0000000106ec1205 wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const + 149 (appbase.cpp:669)
8   libwx_baseu-3.1.dylib         	0x00000001070b427c wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) + 220 (event.cpp:1397)
9   libwx_baseu-3.1.dylib         	0x00000001070b4028 wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) + 248 (event.cpp:1004)
10  libwx_baseu-3.1.dylib         	0x00000001070b62d0 wxEvtHandler::TryHereOnly(wxEvent&) + 128 (event.cpp:1593)
11  libwx_baseu-3.1.dylib         	0x00000001070b601d wxEvtHandler::TryBeforeAndHere(wxEvent&) + 77 (event.h:3890)
12  libwx_baseu-3.1.dylib         	0x00000001070b605f wxEvtHandler::ProcessEventLocally(wxEvent&) + 47 (event.cpp:1526)
13  libwx_baseu-3.1.dylib         	0x00000001070b5efa wxEvtHandler::ProcessEvent(wxEvent&) + 314 (event.cpp:1499)
14  libwx_osx_cocoau_core-3.1.dylib	0x00000001065323c9 wxVarScrollHelperEvtHandler::ProcessEvent(wxEvent&) + 57 (vscroll.cpp:77)
15  libwx_baseu-3.1.dylib         	0x00000001070b60f0 wxEvtHandler::DoTryChain(wxEvent&) + 96 (event.cpp:1558)
16  libwx_baseu-3.1.dylib         	0x00000001070b6079 wxEvtHandler::ProcessEventLocally(wxEvent&) + 73 (event.cpp:1526)
17  libwx_baseu-3.1.dylib         	0x00000001070b5efa wxEvtHandler::ProcessEvent(wxEvent&) + 314 (event.cpp:1499)
18  libwx_baseu-3.1.dylib         	0x00000001070b671f wxEvtHandler::SafelyProcessEvent(wxEvent&) + 47 (event.cpp:1617)
19  libwx_osx_cocoau_core-3.1.dylib	0x00000001064807b5 wxWindowBase::HandleWindowEvent(wxEvent&) const + 37 (wincmn.cpp:1539)
20  libwx_osx_cocoau_core-3.1.dylib	0x0000000106135ced wxWindow::MacDoRedraw(long) + 1421 (window_osx.cpp:1989)
21  libwx_osx_cocoau_core-3.1.dylib	0x0000000106293ad0 wxWidgetCocoaImpl::drawRect(void*, NSView*, void*) + 1408 (window.mm:2323)
22  libwx_osx_cocoau_core-3.1.dylib	0x00000001062901d8 wxOSX_drawRect(NSView*, objc_selector*, CGRect) + 696 (window.mm:1256)
23  com.apple.AppKit              	0x00007fff3b173755 _NSViewDrawRect + 66
24  com.apple.AppKit              	0x00007fff3b17200d -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inContext:shouldChangeFontReferenceColor:stopAtLayerBackedViews:] + 1545
25  com.apple.AppKit              	0x00007fff3b17240b -[NSView(NSInternal) _recursive:displayRectIgnoringOpacity:inContext:shouldChangeFontReferenceColor:stopAtLayerBackedViews:] + 2567
26  com.apple.AppKit              	0x00007fff3b1719f2 __46-[NSView(NSLayerKitGlue) drawLayer:inContext:]_block_invoke + 192
27  com.apple.AppKit              	0x00007fff3b171751 -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 1769
28  com.apple.QuartzCore          	0x00007fff48aaea83 CABackingStoreUpdate_ + 577
29  com.apple.QuartzCore          	0x00007fff48b0f82d invocation function for block in CA::Layer::display_() + 53
30  com.apple.QuartzCore          	0x00007fff48aadc78 -[CALayer _display] + 1839
31  com.apple.AppKit              	0x00007fff3b170caa _NSBackingLayerDisplay + 531
32  com.apple.AppKit              	0x00007fff3b155219 -[_NSViewBackingLayer display] + 811
33  com.apple.QuartzCore          	0x00007fff48aad1a4 CA::Layer::display_if_needed(CA::Transaction*) + 634
34  com.apple.QuartzCore          	0x00007fff48a9b42f CA::Context::commit_transaction(CA::Transaction*) + 319
35  com.apple.QuartzCore          	0x00007fff48a9ad00 CA::Transaction::commit() + 576

comment:7 follow-up: Changed 5 weeks ago by csomor

how can I reproduce your crash with the propgrid sample ? thanks

comment:8 in reply to: ↑ 7 Changed 5 weeks ago by awi

Replying to csomor:

how can I reproduce your crash with the propgrid sample ? thanks

You can apply patch from comment:1 to propgrid sample, run propgrid sample and then minimal propgrid sample (File->Run Minimal Sample) and select any item of EnumProperty.
Should crash on Mojave. Doesn't crash on older OSes.

comment:9 Changed 5 weeks ago by awi

  • Status changed from new to infoneeded_new

@dkulp:
Does b77aa478 changes anything in the paint events sequence observed in the demonstrating sample?

comment:10 Changed 5 weeks ago by csomor

  • Status changed from infoneeded_new to new

sorry for jumping in, basically, the change in the SetSubviewsNeedDisplay removes all unnecessary redraws of subviews that are hidden, and the change in SetVisibility makes sure a Show is triggering a Redraw

Last edited 5 weeks ago by csomor (previous) (diff)

comment:11 Changed 5 weeks ago by csomor

  • Status changed from new to infoneeded_new

comment:12 Changed 5 weeks ago by dkulp

  • Cc dan@… removed
  • Status changed from infoneeded_new to new

I'm not really seeing any difference. With the ClearSelection commented out:

12:44:52 PM: Debug: Property selected: EnumProperty
12:44:52 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: n
12:44:52 PM: Debug: wxEVT_COMBOBOX_DROPDOWN
12:44:52 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: y
12:44:52 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: y
12:44:54 PM: Debug: wxEVT_COMBOBOX_CLOSEUP
12:44:54 PM: Debug: OnPropertyGridChanging(EnumProperty)
12:44:54 PM: Debug: OnPropertyGridChange(EnumProperty, value=Three)
12:44:54 PM: Debug: wxEVT_COMBOBOX
12:44:54 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: n

with it in place:

12:43:07 PM: Debug: Property selected: EnumProperty
12:43:07 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: n
12:43:08 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: n
12:43:08 PM: Debug: wxEVT_COMBOBOX_DROPDOWN
12:43:08 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: y
12:43:08 PM: Debug: wxEVT_PAINT: 0,0  207x23  CB shown: y  CBP: y CBP shown: y
12:43:10 PM: Debug: wxEVT_COMBOBOX_CLOSEUP
12:43:10 PM: Debug: OnPropertyGridChanging(EnumProperty)
12:43:10 PM: Debug: OnPropertyGridChange(EnumProperty, value=Three)
12:43:10 PM: Debug: wxEVT_COMBOBOX
Segmentation fault: 11

comment:13 Changed 5 weeks ago by csomor

at the moment of the crash the popup is still visible, floating around as I write this, and has the new selection highlighted, but GetSelection returned NULL

comment:14 Changed 5 weeks ago by csomor

@dkulp

could you please modify the intro of the MacDoRedraw in your sandbox so that only visible windows get paint events:

bool wxWindowMac::MacDoRedraw( long time )
{
    bool handled = false ;
    if ( !IsShownOnScreen())
        return handled;

...

Last edited 5 weeks ago by csomor (previous) (diff)

comment:15 follow-up: Changed 5 weeks ago by dkulp

  • Cc dan@… added

That does prevent the crash, yes. Seems like a hack to me though.

comment:16 Changed 5 weeks ago by awi

  • Status changed from new to infoneeded_new

@dkulp:
Could you please check if this fix works for you?
It's is compatible with other ports and older OS X versions so if it works we could apply it.

  • src/propgrid/editors.cpp

    diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp
    a b public: 
    645645
    646646        // Enabling double-click processor makes sense
    647647        // only for wxBoolProperty.
    648         wxPGProperty* selProp = GetGrid()->GetSelection();
    649         if (wxDynamicCast(selProp, wxBoolProperty))
     648        m_selProp = GetGrid()->GetSelection();
     649        wxASSERT(m_selProp);
     650        if (wxDynamicCast(m_selProp, wxBoolProperty))
    650651        {
    651             m_dclickProcessor = new wxPGDoubleClickProcessor(this, selProp);
     652            m_dclickProcessor = new wxPGDoubleClickProcessor(this, m_selProp);
    652653            PushEventHandler(m_dclickProcessor);
    653654        }
    654655
    public: 
    729730        );
    730731    }
    731732
     733    wxPGProperty* GetProperty() const { return m_selProp; }
     734
    732735private:
    733736    wxPGDoubleClickProcessor*   m_dclickProcessor;
    734737    bool                        m_sizeEventCalled;
     738    wxPGProperty*               m_selProp;
    735739};
    736740
    737741
    void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, 
    741745                                       wxRect& rect,
    742746                                       int flags )
    743747{
    744     wxPGProperty* p = GetSelection();
     748    wxPGProperty* p = pCb->GetProperty();
     749
    745750    wxString text;
    746751
    747752    const wxPGChoices& choices = p->GetChoices();

comment:17 Changed 5 weeks ago by dkulp

  • Cc dan@… removed
  • Status changed from infoneeded_new to new

Yep. That seems to work and not crash. :)

comment:18 in reply to: ↑ 15 Changed 5 weeks ago by csomor

Replying to dkulp:

That does prevent the crash, yes. Seems like a hack to me though.

not really, in wx we don't expect spurious paint events either too early in construction nor too late when destroying the window, while in macOS these things may happen, I had to introduce blockers in earlier times already. I'll try to find out whether I can do the same in the native cocoa code

comment:19 Changed 5 weeks ago by Artur Wieczorek <artwik@…>

In d735e444f/git-wxWidgets:

Refer to wxPGProperty associated with wxPGComboBox editor in all drawing operations

Store wxPGProperty for which wxPGComboBox editor is activated and use
this reference in all further drawing operations instead of retrieving
each time currently selected wxPGProperty which during the entire
lifetime of the editor is the same as property selected on editor
activation.

See #18211.

comment:20 Changed 5 weeks ago by awi

  • Resolution set to fixed
  • Status changed from new to closed

d735e444 e484a2db should fix the issue.

Note: See TracTickets for help on using tickets.