-
Notifications
You must be signed in to change notification settings - Fork 102
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
Crash in ReplaceCommand::redo #3
Comments
Starting from this commit: 2a662d4 I have rewrited QHexEditData from scratch in order to support big files (and generic QIODevice objects too).
By looking at your source code, I have seen in setupInstructionEncoding() method these lines of code:
which can be rewritten as:
|
OK, good to hear - I'll take a look at that. That said, since internalInsert and internalRemove can return NULL, so I think it would be good to check the return value from them. |
With the fromBuffer() stuff, I can now compile, but I still get the crash. What I do is basically void MainWindow::setupInstructionEncoding()
{
QByteArray buf(32, 0x0);
m_encodingData = QHexEditData::fromMemory(buf);
[...]
m_encodingHexEdit = new QHexEdit(m_ui->instructionEncodingLineEdit);
m_encodingHexEdit->setData(m_encodingData);
}
void MainWindow::updateInstructionEncoding(const IInstruction* insn)
{
uint8_t buf[32];
[... fill in buf]
m_encodingData->replace(0, 32, QByteArray((const char *)buf, sizeof(buf)));
} where updateInstructionEncoding is called to fill in the current position. I get a crash in replace(), and get the same behavior when using remove() + insert(). |
Ok, I can reproduce this bug, I will fix it in short time! |
The commit e7eb910 should fix the bug. Let me know if it works now. |
Yes, after that commit it works again. Thanks! On Sat, Jan 18, 2014 at 6:35 PM, Antonio Davide notifications@github.comwrote:
|
Great! |
After updating the git repo, I now get crashes in ReplaceCommand::redo because this->_inscmd or this->_remcmd is null (as returned by internalInsert (or internalRemove).
I've added null-checks for the result, which fixes the crash but my hexedits are completely empty after this.
I might be using it in the wrong way, an example is this function:
https://github.com/SimonKagstrom/emilpro/blob/master/src/qt/emilpro/mainwindow.cpp#L640
The text was updated successfully, but these errors were encountered: