Discussion of all aspects of the game engine, including development of new and existing features.

Moderators: Forum Moderators, Developers

Post Reply
Android Port Maintainer
Posts: 158
Joined: June 24th, 2013, 6:22 am


Post by alep » December 19th, 2016, 2:54 pm

I was starting to try out the 1.13 version for android, and the first run gave me a black screen. After digging out a bit I stumled upon this lines in events.cpp:

Code: Select all

// TODO: I'm uncertain if this is always safe to call at static init; maybe set in main() instead?
static const boost::thread::id main_thread = boost::this_thread::get_id();
That was the cause of the black screen: since I load c++ code from a shared object (.so) on a different thread from the one that's going to run wesnoth, this gets initialized to a wrong value.
I fixed that in android version by adding an #ifdef ANDROID and let main() initialize the variable, but because of the comment I also wanted to let you know that no, it's not safe to initialize main_thread like that (at least, in my android port it is not ;) ).

User avatar
Posts: 1336
Joined: August 3rd, 2012, 11:26 pm

Re: main_thread

Post by Celtic_Minstrel » May 3rd, 2017, 3:55 am

I suggest opening a pull request to the main Wesnoth repository which instead initializes the variable from main(), like you described.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

Post Reply