mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-29 03:32:48 +00:00
Show an error if we cannot create a ToolLoopImpl
The main issue at the moment is that a std::bad_alloc exception can be thrown if there isn't enough memory available when the user click the sprite editor to start drawing.
This commit is contained in:
parent
efbb3e52e2
commit
60602f78a8
@ -360,15 +360,26 @@ tools::ToolLoop* create_tool_loop(Editor* editor, Context* context, MouseMessage
|
||||
}
|
||||
|
||||
// Create the new tool loop
|
||||
return
|
||||
new ToolLoopImpl(editor,
|
||||
context,
|
||||
current_tool,
|
||||
editor->getDocument(),
|
||||
msg->left() ? tools::ToolLoop::Left:
|
||||
tools::ToolLoop::Right,
|
||||
msg->left() ? fg: bg,
|
||||
msg->left() ? bg: fg);
|
||||
try
|
||||
{
|
||||
return new ToolLoopImpl(editor,
|
||||
context,
|
||||
current_tool,
|
||||
editor->getDocument(),
|
||||
msg->left() ? tools::ToolLoop::Left:
|
||||
tools::ToolLoop::Right,
|
||||
msg->left() ? fg: bg,
|
||||
msg->left() ? bg: fg);
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
Alert::show(PACKAGE
|
||||
"<<Error drawing ink:"
|
||||
"<<%s"
|
||||
"||&Close",
|
||||
ex.what());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
Loading…
x
Reference in New Issue
Block a user