mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-04 05:50:15 +00:00
Linux: Fix crash using Aseprite in batch mode
Reported here: http://steamcommunity.com/app/431730/discussions/2/1499000547480220354/
This commit is contained in:
parent
31bf851d4f
commit
4c9e67de18
@ -231,38 +231,39 @@ void App::initialize(const AppOptions& options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
she::instance()->finishLaunching();
|
she::instance()->finishLaunching();
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
|
||||||
try {
|
|
||||||
she::Display* display = she::instance()->defaultDisplay();
|
|
||||||
she::SurfaceList icons;
|
|
||||||
|
|
||||||
for (const int size : { 32, 64, 128 }) {
|
|
||||||
ResourceFinder rf;
|
|
||||||
rf.includeDataDir(fmt::format("icons/ase{0}.png", size).c_str());
|
|
||||||
if (rf.findFirst()) {
|
|
||||||
she::Surface* surf = she::instance()->loadRgbaSurface(rf.filename().c_str());
|
|
||||||
if (surf)
|
|
||||||
icons.push_back(surf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
display->setIcons(icons);
|
|
||||||
|
|
||||||
for (auto surf : icons)
|
|
||||||
surf->dispose();
|
|
||||||
}
|
|
||||||
catch (const std::exception&) {
|
|
||||||
// Just ignore the exception, we couldn't change the app icon, no
|
|
||||||
// big deal.
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::run()
|
void App::run()
|
||||||
{
|
{
|
||||||
// Run the GUI
|
// Run the GUI
|
||||||
if (isGui()) {
|
if (isGui()) {
|
||||||
|
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||||
|
// Setup app icon for Linux window managers
|
||||||
|
try {
|
||||||
|
she::Display* display = she::instance()->defaultDisplay();
|
||||||
|
she::SurfaceList icons;
|
||||||
|
|
||||||
|
for (const int size : { 32, 64, 128 }) {
|
||||||
|
ResourceFinder rf;
|
||||||
|
rf.includeDataDir(fmt::format("icons/ase{0}.png", size).c_str());
|
||||||
|
if (rf.findFirst()) {
|
||||||
|
she::Surface* surf = she::instance()->loadRgbaSurface(rf.filename().c_str());
|
||||||
|
if (surf)
|
||||||
|
icons.push_back(surf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
display->setIcons(icons);
|
||||||
|
|
||||||
|
for (auto surf : icons)
|
||||||
|
surf->dispose();
|
||||||
|
}
|
||||||
|
catch (const std::exception&) {
|
||||||
|
// Just ignore the exception, we couldn't change the app icon, no
|
||||||
|
// big deal.
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialize Steam API
|
// Initialize Steam API
|
||||||
#ifdef ENABLE_STEAM
|
#ifdef ENABLE_STEAM
|
||||||
steam::SteamAPI steam;
|
steam::SteamAPI steam;
|
||||||
|
@ -537,6 +537,9 @@ void Alleg4Display::setIcons(const SurfaceList& icons)
|
|||||||
{
|
{
|
||||||
#ifdef ALLEGRO_UNIX
|
#ifdef ALLEGRO_UNIX
|
||||||
|
|
||||||
|
if (!_xwin.display || !_xwin.wm_window)
|
||||||
|
return;
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (Surface* icon : icons) {
|
for (Surface* icon : icons) {
|
||||||
auto display = _xwin.display;
|
auto display = _xwin.display;
|
||||||
|
Loading…
Reference in New Issue
Block a user