Merge branch 'crashlog_improvements' into jgrpp

This commit is contained in:
Jonathan G Rennison
2016-03-21 20:47:16 +00:00
4 changed files with 8 additions and 4 deletions

View File

@@ -110,7 +110,7 @@ struct Pool : PoolBase {
*/ */
inline Titem *Get(size_t index) inline Titem *Get(size_t index)
{ {
assert(index < this->first_unused); assert_msg(index < this->first_unused, "index: %zu, first_unused: %zu, name: %s", index, this->first_unused, this->name);
return this->data[index]; return this->data[index];
} }
@@ -166,7 +166,7 @@ struct Pool : PoolBase {
{ {
if (p == NULL) return; if (p == NULL) return;
Titem *pn = (Titem *)p; Titem *pn = (Titem *)p;
assert(pn == Tpool->Get(pn->index)); assert_msg(pn == Tpool->Get(pn->index), "name: %s", Tpool->name);
Tpool->FreeItem(pn->index); Tpool->FreeItem(pn->index);
} }
@@ -200,7 +200,7 @@ struct Pool : PoolBase {
* memory are the same (because of possible inheritance). * memory are the same (because of possible inheritance).
* Use { size_t index = item->index; delete item; new (index) item; } * Use { size_t index = item->index; delete item; new (index) item; }
* instead to make sure destructor is called and no memory leaks. */ * instead to make sure destructor is called and no memory leaks. */
assert(ptr != Tpool->data[i]); assert_msg(ptr != Tpool->data[i], "name: %s", Tpool->name);
} }
return ptr; return ptr;
} }

View File

@@ -172,7 +172,7 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
FontCache::Get(FS_MONO)->GetFontName() FontCache::Get(FS_MONO)->GetFontName()
); );
buffer += seprintf(buffer, last, "AI Configuration (local: %i):\n", (int)_local_company); buffer += seprintf(buffer, last, "AI Configuration (local: %i) (current: %i):\n", (int)_local_company, (int)_current_company);
const Company *c; const Company *c;
FOR_ALL_COMPANIES(c) { FOR_ALL_COMPANIES(c) {
if (c->ai_info == NULL) { if (c->ai_info == NULL) {

View File

@@ -206,6 +206,8 @@ class CrashLogUnix : public CrashLog {
} }
buffer += seprintf(buffer, last, "\n"); buffer += seprintf(buffer, last, "\n");
close(pipefd[0]); /* close read end */
int status; int status;
int wait_ret = waitpid(pid, &status, 0); int wait_ret = waitpid(pid, &status, 0);
if (wait_ret == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { if (wait_ret == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0) {

View File

@@ -826,6 +826,8 @@ void Vehicle::PreDestructor()
{ {
if (CleaningPool()) return; if (CleaningPool()) return;
SCOPE_INFO_FMT([this], "Vehicle::PreDestructor: %s", scope_dumper().VehicleInfo(this));
if (Station::IsValidID(this->last_station_visited)) { if (Station::IsValidID(this->last_station_visited)) {
Station *st = Station::Get(this->last_station_visited); Station *st = Station::Get(this->last_station_visited);
st->loading_vehicles.remove(this); st->loading_vehicles.remove(this);