I'm trying to use wxFreeChart 1.6 with wxWidgets 3.0.2 compiled with gcc under Windows.
There are two scenarios where no chart can be displayed and the demo app and/or the application using wxFreeChart crashes:
- Using gcc compiler optimization -O3 (demo app and user app)
- When deriving from wxChartPanel and creating an instance thereof (only user app)
When I use compiler optimization -O2, there is no crash. When I use the class wxChartPanel directly, there is no crash either.
Does anyone has found a similar behavior and/or has found where the problem is?
wxFreeChart crashes with gcc optimization -O3 and when deriving from wxChartPanel
Re: wxFreeChart crashes with gcc optimization -O3 and when deriving from wxChartPanel
Which gcc version?
Sounds like a compiler bug.- Using gcc compiler optimization -O3 (demo app and user app)
Hard to tell without seeing code.- When deriving from wxChartPanel and creating an instance thereof (only user app)
Use the source, Luke!
Re: wxFreeChart crashes with gcc optimization -O3 and when deriving from wxChartPanel
Please check to make sure that your wxChartPanel is not being set to either wxSize(0,0) or wxDefaultSize (I can't remember which) because this was causing a lot of crashes for me.
wxWidgets 3.1.2, MinGW64 8.1.0, g++ 8.1.0, Ubuntu 19.04, Windows 10, CodeLite + wxCrafter
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
Re: wxFreeChart crashes with gcc optimization -O3 and when deriving from wxChartPanel
I use mingw32 with gcc 4.7.2 compiler.
Regarding the second problem, I have found the problem. This is the test class that is derived from wxChartPanel:
The problem was that I did not pass the parent window to wxChartPanel properly. So now I can derive from wxChartPanel with ease.
I did not see a problem with wxSize(0,0) or wxDefaultSize so far.
Regarding the second problem, I have found the problem. This is the test class that is derived from wxChartPanel:
Code: Select all
class MyChartPanel : public wxChartPanel
{
public:
/**
* @brief Constructor.
*
* @param pParent Parent window.
* @param pId Window identifier. If <code>wxID_ANY</code> a new unique identifier is created.
* @param pPos Window position.
* @param pSize Window size.
*/
MyChartPanel( wxWindow *pParent, wxWindowID pId = wxID_ANY,
const wxPoint &pPos = wxDefaultPosition,
const wxSize &pSize = wxDefaultSize );
/**
* @brief Destructor.
*/
virtual ~MyChartPanel();
};
// Implementation of constructor & destructor
MyChartPanel::MyChartPanel( wxWindow *pParent, wxWindowID pId,
const wxPoint &pPos,
const wxSize &pSize )
// : wxChartPanel(this, pId, NULL, pPos, pSize) { // crash
: wxChartPanel(pParent, pId, NULL, pPos, pSize) { // no crash
// nothing to do here
}
MyChartPanel::~MyChartPanel() {
// nothing to do here
}
I did not see a problem with wxSize(0,0) or wxDefaultSize so far.
Re: wxFreeChart crashes with gcc optimization -O3 and when deriving from wxChartPanel
I noticed a similar issue with wxFreeChart and wxWidgets trunk, but it was "only" an assert for me, easily fixed:ErwinH wrote:I did not see a problem with wxSize(0,0) or wxDefaultSize so far.
https://github.com/pbfordev/wxFreeChart ... 872d6ffb4e
Re: wxFreeChart crashes with gcc optimization -O3 and when deriving from wxChartPanel
Ah yes, that is exactly it. Sorry, I forgot that they were only asserts.I noticed a similar issue with wxFreeChart and wxWidgets trunk, but it was "only" an assert for me, easily fixed:
https://github.com/pbfordev/wxFreeChart ... 872d6ffb4e
wxWidgets 3.1.2, MinGW64 8.1.0, g++ 8.1.0, Ubuntu 19.04, Windows 10, CodeLite + wxCrafter
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.