mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-03 21:46:20 +00:00
Avoid crashes when some EditorState in Editor::onProcessMessage() cannot lock the document
This commit is contained in:
parent
b4d97a4d35
commit
66c5f76146
@ -155,7 +155,7 @@ void Console::printf(const char* format, ...)
|
||||
void Console::showException(const std::exception& e)
|
||||
{
|
||||
Console console;
|
||||
console.printf("A problem has occurred.\n\nDetails:\n%s", e.what());
|
||||
console.printf("A problem has occurred.\n\nDetails:\n%s\n", e.what());
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "app/app.h"
|
||||
#include "app/app_menus.h"
|
||||
#include "app/commands/commands.h"
|
||||
#include "app/console.h"
|
||||
#include "app/document_access.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/palettes.h"
|
||||
@ -37,6 +38,8 @@
|
||||
#include "ui/system.h"
|
||||
#include "ui/view.h"
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
namespace app {
|
||||
|
||||
using namespace ui;
|
||||
@ -132,7 +135,20 @@ protected:
|
||||
}
|
||||
break;
|
||||
}
|
||||
return Editor::onProcessMessage(msg);
|
||||
|
||||
try {
|
||||
return Editor::onProcessMessage(msg);
|
||||
}
|
||||
catch (const LockedDocumentException& ex) {
|
||||
Console console;
|
||||
Console::showException(ex);
|
||||
console.printf("\nInternal details:\n"
|
||||
"- Message type: %d\n"
|
||||
"- Editor state: %s\n",
|
||||
msg->type(),
|
||||
getState() ? typeid(*getState().get()).name(): "None");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user