mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-27 15:35:21 +00:00
Fix crash if an exception happens in DelayedMouseMove::commitMouseMove()
Without this an exception in DelayedMouseMove::commitMouseMove() could produce (e.g.) the crash in #3818. This same error handling was already done for Editor::onProcessMessage() in DocView::onProcessMessage() to avoid crashing due unhandled exceptions in Editor message processing.
This commit is contained in:
parent
f178941f2c
commit
d8ed4d3995
@ -167,15 +167,7 @@ protected:
|
||||
return Editor::onProcessMessage(msg);
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
EditorState* state = getState().get();
|
||||
|
||||
Console console;
|
||||
Console::showException(ex);
|
||||
console.printf("\nInternal details:\n"
|
||||
"- Message type: %d\n"
|
||||
"- Editor state: %s\n",
|
||||
msg->type(),
|
||||
state ? typeid(*state).name(): "None");
|
||||
showUnhandledException(ex, msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,12 @@ void DelayedMouseMove::commitMouseMove()
|
||||
if (m_timer.isRunning())
|
||||
m_timer.stop();
|
||||
|
||||
m_delegate->onCommitMouseMove(m_editor, spritePos());
|
||||
try {
|
||||
m_delegate->onCommitMouseMove(m_editor, spritePos());
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
m_editor->showUnhandledException(ex, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
const gfx::PointF& DelayedMouseMove::spritePos() const
|
||||
|
@ -1897,6 +1897,21 @@ void Editor::cancelSelections()
|
||||
clearSlicesSelection();
|
||||
}
|
||||
|
||||
void Editor::showUnhandledException(const std::exception& ex,
|
||||
const ui::Message* msg)
|
||||
{
|
||||
EditorState* state = getState().get();
|
||||
|
||||
Console console;
|
||||
Console::showException(ex);
|
||||
console.printf(
|
||||
"\nInternal details:\n"
|
||||
"- Message type: %d\n"
|
||||
"- Editor state: %s\n",
|
||||
(msg ? msg->type(): -1),
|
||||
(state ? typeid(*state).name(): "None"));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Message handler for the editor
|
||||
|
||||
|
@ -322,6 +322,11 @@ namespace app {
|
||||
// Properties to show information in the status bar
|
||||
bool showAutoCelGuides() const { return m_showAutoCelGuides; }
|
||||
|
||||
// Used in case an unhandled exception was caught when processing
|
||||
// an Editor or EditorState event.
|
||||
void showUnhandledException(const std::exception& ex,
|
||||
const ui::Message* msg);
|
||||
|
||||
static void registerCommands();
|
||||
|
||||
protected:
|
||||
|
Loading…
x
Reference in New Issue
Block a user