-
Notifications
You must be signed in to change notification settings - Fork 25
Styleguide conformance #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
In SFMLEvent, if the destructor is to throw no exceptions, noexcept must be specified for every destructor for every child class (Application and AppStateGame), otherwise you should get a compiler error. After fixing that the program compiles for me, but I get an segfault upon load from an unknown area (where an exception isn't thrown). I'll investigate further shortly. |
|
All destructors are |
|
4.7.2 on ubuntu. I get "looser throw specifier" in dtors that inherit SFMLEvent. |
|
Force of habit. But it is supposed to compile according to the C++11 standard, explicit or not. |
|
Hmm. Well, I either declare noexcept for daughter classes or I remove noexept from the SFLEvent destructor and it compiles. I still need to figure out why she's segfaulting, though. :/ EDIT: |
|
I really wish I could test but I still can't link SFML. I've kind of given up on that :\ all I can do is see if it compiles. Can you get any debug information about where it segfaults? Does anything ever get written to the log files? |
|
There's got to be something we're doing wrong.. I can link fine on Linux, but I still can't link SFML properly on Windows. I've given up as well, lol. No debug output about the crash is logged, probably because it's not caused by an exception that we're intentionally trowing. |
I meant does the code even get to a point where stuff gets written to the log files? Do the log files even get created? I'm talking about the ones that |
|
Yeah yeah, they get created. It loads all the images fine and generates piece positions. Then nothing. |
|
So, it finishes If you can't deduce the crash in the debugger can you try putting debugs statements along that call stack to see where it stops? I'll investigate |
|
Okay I've narrowed down the issue. I ran the program through gdb and (after stepping through a lot of stuff), the program segfaulted on calling Relevant GDB output: This is occuring in EDIT: |
|
I only made spacing changes to Piece, I really have no idea what's going on here. |
|
Okay I've found the issue. The problem occurs in void GraphicsHandler::drawBoard(const board::Board *b)
{
drawBackground();
// Valid moves are drawn for the piece being hovered over
// Or the piece that is currently selected
board::Piece*pCurrent = b->getCurrent();
board::Piece*pSelect = b->getSelected();
if (pSelect)
for (auto &i: pSelect->getTrajectory())On line 6 and 7 of the above snippet, pCurrent and pSelect are gotten from board. The first time this function is called (no pieces have been drawn on the board yet), pCurrent and pSelect should be null ~ the cursor is not over a piece, and the user hasn't clicked on a piece. However, I fixed this by changing the Board::Board()
: pieces(WIDTH*WIDTH),
selectedPiece(nullptr),
currentPiece(nullptr)
{
}Those internal EDIT: We should probably wrap |
This change is obsolete, however.
|
I committed the fix, make sure it works now.
In my later code they don't even exist anymore :) |
|
It's all good in that commit. |
Mostly changed spacing for things, refactored the code a bit, etc. Make sure it compiles and runs properly for you!