add dive implementation pushed

Linus Torvalds torvalds at
Sat Sep 21 10:03:40 UTC 2013

Current subsurface segfaults for me:

  #0  0x0000000000452189 in MainTab::updateDiveInfo (this=0x974bd0,
dive=-1) at qt-ui/maintab.cpp:244

because 'd' is NULL.

See the code:

242   UPDATE_TEMP(d, airtemp);
243   UPDATE_TEMP(d, watertemp);
244   ui->dateTimeEdit->setDateTime(QDateTime::fromTime_t(d->when -
245   if (d) {
246      char buffer[256];
247      print_gps_coordinates(buffer, sizeof buffer,
d->latitude.udeg, d->longitude.udeg);

ie we test for 'd' being NULL, but the new "setDateTime()" call uses
"d->when" before that call.

This was introduced by commit a8888eaf26c9 ("Allow editing of date &
time and air & water temperatures").

Moving the time handling inside the if() statement fixes it.


More information about the subsurface mailing list