Menu

#94 wxSpinCtrl editor doesn't work properly with Freeze()

open-fixed
None
3
2008-12-11
2008-12-08
AmiArt
No

The wxSpinCtrl editor behaves strangely when the wxPropertyGridManager::Freeze() is called inside EVT_PG_CHANGED event. Sometimes it hangs the program, and sometimes it is impossible to change the value by clicking Up/Down buttons.

It worked in wxPropertyGrid 1.4.1, now it's broken.

To reproduce this bug I have modified the wxPropertyGrid sample app:

1. In propgridsample.cpp (line 1927) modify the body of OnPropertyChange method as follows:

void wxMyPropertyGridPage::OnPropertyChange( wxPropertyGridEvent& event )
{
wxPGProperty* p = event.GetProperty();

m_manager->Freeze();

// Do something

m_manager->Thaw();
}

2. Compile sample app.
3. Go to third page called 'Examples'.
4. Now try to change the value of 'SpinCtrl' property by clicking Up/Down buttons.

Config:
wxPropertyGrid 1.4.2, wxGTK 2.8.9, Ubuntu 8.04, GCC 4.2.4

Discussion

  • AmiArt

    AmiArt - 2008-12-08
    • assigned_to: nobody --> jmsalli
     
  • Jaakko Salli

    Jaakko Salli - 2008-12-08

    I've at least partially fixed this in SVN trunk. Let me know how it works for you.

    Thanks!

     
  • AmiArt

    AmiArt - 2008-12-08

    It didn't help. I tested this again and it turned out that the sample app hangs even if I don't call Freeze() inside OnPropertyChange().

    I noticed this when I changed the value of 'SpinCtrl' property by PRESSING AND HOLDING the Up button and then doing the same with Down button. In my scenario it was: increase the value to 50, decrease to 0, increase 50, decrease to 0 ...

    This happens in original 1.4.2 and latest SVN version. Both wxGTK and wxPropertyGrid are compiled in unicode debug mode.

     
  • AmiArt

    AmiArt - 2008-12-08

    On Windows XP the sample app behaves strangely only if we call Freeze() inside OnPropertyChange, without Freeze() everything seems to be ok.

     
  • Jaakko Salli

    Jaakko Salli - 2008-12-10

    Right, it works much better on Win XP. Some spin ctrl scroll events seem to be unintentionally propagated to scrolled window and there is a lot of flicker due to stuff done in Thaw(). But anyway, it does not freeze or anything.

    However, I've managed to reproduce the hang on my Linux VM (which incidentally is also Ubuntu 8.04), and by hang I mean the entire VM froze :)

    Thanks for the report so far. I need to take a better look at this soon.

     
  • AmiArt

    AmiArt - 2008-12-10
     
  • AmiArt

    AmiArt - 2008-12-10

    Same thing happens to me - the whole system is frozen and I cannot even switch to another application.
    Fortunately I managed to recover from the freeze (by pressing CTRL+ALT+DEL) and got an assertion:

    assert "GetCapture() != this" failed in ~wxWindowBase(): attempt to destroy window with mouse capture

    The attached file contains the stack dump. It should be useful.

    Thanks for help.

    File Added: dump.txt

     
  • Jaakko Salli

    Jaakko Salli - 2008-12-11

    I've now disabled (by default) the "value change by mouse motion" feature in SpinCtrl editor, and also completely disabled it on non-MSW platforms.

    Not a real fix, but right now I don't have more time to look at this issue. I didn't actually test if it works now on Linux, but I'm 99% confident that this new feature was the culprit.

     
  • Jaakko Salli

    Jaakko Salli - 2008-12-11
    • status: open --> open-fixed
     
  • Jaakko Salli

    Jaakko Salli - 2008-12-11
    • priority: 5 --> 3
     

Log in to post a comment.