Merge lp:~widelands-dev/widelands/bug-1794924-logger-assert into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8874
Proposed branch: lp:~widelands-dev/widelands/bug-1794924-logger-assert
Merge into: lp:widelands
Diff against target: 15 lines (+3/-2)
1 file modified
src/wlapplication.cc (+3/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1794924-logger-assert
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+355823@code.launchpad.net

Commit message

Use std::cout for logging when calling terminate on shutdown, because the logger might not exist any more.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4067. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/434562141.
Appveyor build 3863. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1794924_logger_assert-3863.

Revision history for this message
Notabilis (notabilis27) wrote :

Diff is looking okay, but unfortunately I am unable to force the message on purpose so I wasn't able to test it.
As a suggestion: Maybe use std::cerr instead of std::cout for this message?

Revision history for this message
GunChleoc (gunchleoc) wrote :

We still have problems with logging std::cerr on Windows, so I prefer keeping it in std::cout for now.

I have tested this by leaving Widelands while another terminal was linking a debug build - that will make my system slow enough to trigger it *lol

Thanks for the review!

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wlapplication.cc'
2--- src/wlapplication.cc 2018-09-24 08:35:06 +0000
3+++ src/wlapplication.cc 2018-09-28 09:31:40 +0000
4@@ -103,8 +103,9 @@
5 */
6 #ifndef _WIN32
7 void terminate(int) {
8- log("Waited 5 seconds to close audio. There are some problems here, so killing Widelands."
9- " Update your sound driver and/or SDL to fix this problem\n");
10+ // The logger can already be shut down, so we use cout
11+ std::cout << "Waited 5 seconds to close audio. There are some problems here, so killing Widelands."
12+ " Update your sound driver and/or SDL to fix this problem\n";
13 raise(SIGKILL);
14 }
15 #endif

Subscribers

People subscribed via source and target branches

to status/vote changes: