widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #09284
Re: [Merge] lp:~widelands-dev/widelands/unique_ptr_coroutine into lp:widelands
Review: Approve compile, test
Compiled this and I am now playing the ecomony Tutorial,
again I got [.../unique_ptr_coroutine/src/scripting/lua_errors.cc:22] [string "scripting/mission_thread.lua"]:100: attempt to index a nil value (field 'ware_statistics') Send message to all players and pause game while checkhin the third tab in the ware statistics
The Game went one, but the Tutorial does not proceed :-(
But at this happend on some other Rbanch ,too it should be unrelated.
SirVer: feel free to merege this in, but tlet us get the Tutorial fixed, too.
Diff comments:
> === modified file 'src/logic/cmd_luacoroutine.cc'
> --- src/logic/cmd_luacoroutine.cc 2016-08-04 15:49:05 +0000
> +++ src/logic/cmd_luacoroutine.cc 2016-12-26 22:29:03 +0000
> @@ -34,16 +34,17 @@
>
> namespace Widelands {
>
> +CmdLuaCoroutine::~CmdLuaCoroutine() {
> +}
> +
Very good, heaving explicit DTor helps a lot with stacktraces etc.
> void CmdLuaCoroutine::execute(Game& game) {
> try {
> int rv = cr_->resume();
> const uint32_t sleeptime = cr_->pop_uint32();
> if (rv == LuaCoroutine::YIELDED) {
> - game.enqueue_command(new Widelands::CmdLuaCoroutine(sleeptime, cr_));
> - cr_ = nullptr; // Remove our ownership so we don't delete.
> + game.enqueue_command(new Widelands::CmdLuaCoroutine(sleeptime, std::move(cr_)));
> } else if (rv == LuaCoroutine::DONE) {
> - delete cr_;
> - cr_ = nullptr;
> + cr_.reset();
> }
> } catch (LuaError& e) {
> log("Error in Lua Coroutine\n");
--
https://code.launchpad.net/~widelands-dev/widelands/unique_ptr_coroutine/+merge/313880
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/unique_ptr_coroutine.
Follow ups
References