Process terminated with status 3

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Slyde
Earned some good credits
Earned some good credits
Posts: 136
Joined: Mon Apr 09, 2018 11:08 pm

Process terminated with status 3

Post by Slyde »

Just checking out wxWidgets3.1.4 because I was told "a lot of work" had been done to the wxGrid.

So I created a small frame-based app and set a grid (10 cols x 12 rows) on it in hopes of seeing alternate colors for the grid rows. When I saw nothing for that, I opened the griddemo.cpp sample and looked at the SetRowAttr(). I copied it over to my file and changed it a little:

Code: Select all

wxGridCellAttr *attr;
    attr = new wxGridCellAttr;
    attr->SetTextColour(*wxBLUE);
    Grid1->SetColAttr(5, attr);
    attr = new wxGridCellAttr;
    attr->SetBackgroundColour(wxColour( 255, 232, 255, wxALPHA_TRANSPARENT));
    for(int i{}; i +1 <= 10; ++i){
        if(i % 2){
            Grid1->SetRowAttr(i, attr);
        }
    }
It works fine. I can access the Menu items (the stock ones: Quit and About) and they work as expected. But when I close the app, I get various termination messages. One of them is in the title here. Another is Process terminated with status -1073740940. Can someone tell me why this is?

Thanks.

This is on Win X using Code::Blocks.

UPDATE: For some reason, the problem seems to occur only when Grid1->SetRowAttr(i, attr); is called repetitively. I changed the above code to call it only once and all was fine. However, even calling it twice brought back the status codes again. I'll get it to point where data is being put in the grid and see what happens when I color alternate lines on it.
Linux Mint 21.3 | wxWidgets-3.2.4
Windows 10 | wxWidgets-3.2.4
CLion IDE
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Process terminated with status 3

Post by doublemax »

From the documentation for wxGrid::SetAttr()
Sets the cell attributes for the specified cell.
The grid takes ownership of the attribute pointer.
If you use the same pointer multiple times, you need to increase its reference counter.

Try calling wxGridCellAttr::IncRef()
https://docs.wxwidgets.org/trunk/classw ... 42cccbcf43

BTW:
Process terminated with status -1073740940
Error messages like this are usually useless. Next time please run your app in debug mode and provide a call stack.
Use the source, Luke!
Post Reply