Index: src/tspmodel.cpp
===================================================================
--- src/tspmodel.cpp	(revision 278bc7818ff0dbce80337ca38abd43ceaaf101a8)
+++ src/tspmodel.cpp	(revision 394216e4680e854a3aa3a56decff8d1cccb5f94c)
@@ -81,9 +81,9 @@
 	} else if (role == Qt::DisplayRole || role == Qt::EditRole) {
 		if (index.row() < nCities && index.column() < nCities)
-			if (table[index.row()][index.column()] == INFINITY)
+			if (table.at(index.row()).at(index.column()) == INFINITY)
 				return tr(INFSTR);
 			else
 //! \hack HACK: Converting to string to prevent spinbox in edit mode
-				return QVariant(table[index.row()][index.column()]).toString();
+				return QVariant(table.at(index.row()).at(index.column())).toString();
 		else
 			return QVariant();
@@ -139,5 +139,7 @@
 	if (!f.open(QIODevice::ReadOnly)) {
 		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Load"),QString(tr("Unable to open task file.\nError: %1")).arg(f.errorString()),QMessageBox::Ok).exec();
+		QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Load"), QString(tr("Unable to open task file.\nError: %1")).arg(f.errorString()));
+		QApplication::restoreOverrideCursor();
 		return false;
 	}
@@ -163,5 +165,7 @@
 		f.close();
 		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Load"),tr("Unable to load task:") + "\n" + tr("Unknown file format or file is corrupted."),QMessageBox::Ok).exec();
+		QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n" + tr("Unknown file format or file is corrupted."));
+		QApplication::restoreOverrideCursor();
 		return false;
 	}
@@ -232,5 +236,6 @@
 	if (!f.open(QIODevice::WriteOnly)) {
 		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Save"),QString(tr("Unable to create task file.\nError: %1\nMaybe, file is read-only?")).arg(f.errorString()),QMessageBox::Ok).exec();
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Save"), QString(tr("Unable to create task file.\nError: %1\nMaybe, file is read-only?")).arg(f.errorString()));
+		f.remove();
 		return false;
 	}
@@ -238,7 +243,8 @@
 	ds.setVersion(QDataStream::Qt_4_4);
 	if (f.error() != QFile::NoError) {
-		f.close();
-		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Save"),tr("Unable to save task.\nError: %1").arg(f.errorString()),QMessageBox::Ok).exec();
+		QApplication::restoreOverrideCursor();
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Save"), tr("Unable to save task.\nError: %1").arg(f.errorString()));
+		f.close();
+		f.remove();
 		return false;
 	}
@@ -246,7 +252,8 @@
 	ds << TSPT;
 	if (f.error() != QFile::NoError) {
-		f.close();
-		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Save"),tr("Unable to save task.\nError: %1").arg(f.errorString()),QMessageBox::Ok).exec();
+		QApplication::restoreOverrideCursor();
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Save"), tr("Unable to save task.\nError: %1").arg(f.errorString()));
+		f.close();
+		f.remove();
 		return false;
 	}
@@ -254,7 +261,8 @@
 	ds << TSPT_VERSION;
 	if (f.error() != QFile::NoError) {
-		f.close();
-		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Save"),tr("Unable to save task.\nError: %1").arg(f.errorString()),QMessageBox::Ok).exec();
+		QApplication::restoreOverrideCursor();
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Save"), tr("Unable to save task.\nError: %1").arg(f.errorString()));
+		f.close();
+		f.remove();
 		return false;
 	}
@@ -262,7 +270,8 @@
 	ds << TSPT_META_VERSION;
 	if (f.error() != QFile::NoError) {
-		f.close();
-		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Save"),tr("Unable to save task.\nError: %1").arg(f.errorString()),QMessageBox::Ok).exec();
+		QApplication::restoreOverrideCursor();
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Save"), tr("Unable to save task.\nError: %1").arg(f.errorString()));
+		f.close();
+		f.remove();
 		return false;
 	}
@@ -270,7 +279,8 @@
 	ds << OSID;
 	if (f.error() != QFile::NoError) {
-		f.close();
-		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Save"),tr("Unable to save task.\nError: %1").arg(f.errorString()),QMessageBox::Ok).exec();
+		QApplication::restoreOverrideCursor();
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Save"), tr("Unable to save task.\nError: %1").arg(f.errorString()));
+		f.close();
+		f.remove();
 		return false;
 	}
@@ -278,7 +288,8 @@
 	ds << nCities;
 	if (f.error() != QFile::NoError) {
-		f.close();
-		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Save"),tr("Unable to save task.\nError: %1").arg(f.errorString()),QMessageBox::Ok).exec();
+		QApplication::restoreOverrideCursor();
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Save"), tr("Unable to save task.\nError: %1").arg(f.errorString()));
+		f.close();
+		f.remove();
 		return false;
 	}
@@ -289,7 +300,8 @@
 				ds << static_cast<double>(table[r][c]); // We cast to double because double may be float on some platforms and we store double values in file
 				if (f.error() != QFile::NoError) {
+					QApplication::restoreOverrideCursor();
+					QMessageBox::critical(QApplication::activeWindow(), tr("Task Save"), tr("Unable to save task.\nError: %1").arg(f.errorString()));
 					f.close();
-					QApplication::restoreOverrideCursor();
-					QMessageBox(QMessageBox::Critical,tr("Task Save"),tr("Unable to save task.\nError: %1").arg(f.errorString()),QMessageBox::Ok).exec();
+					f.remove();
 					return false;
 				}
@@ -369,5 +381,7 @@
 		err = tr("Unknown error.");
 	QApplication::restoreOverrideCursor();
-	QMessageBox(QMessageBox::Critical,tr("Task Load"),tr("Unable to load task:") + "\n" + err,QMessageBox::Ok).exec();
+	QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
+	QMessageBox::critical(QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n" + err);
+	QApplication::restoreOverrideCursor();
 	return true;
 }
@@ -386,5 +400,7 @@
 	if (version > TSPT_VERSION) {
 		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Load"),tr("Unable to load task:") + "\n" + tr("File version is newer than application supports.\nPlease, try to update application."),QMessageBox::Ok).exec();
+		QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n" + tr("File version is newer than application supports.\nPlease, try to update application."));
+		QApplication::restoreOverrideCursor();
 		return false;
 	}
@@ -400,5 +416,7 @@
 	if ((size < 3) || (size > MAX_NUM_CITIES)) {
 		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Load"),tr("Unable to load task:") + "\n" + tr("Unexpected data read.\nFile is possibly corrupted."),QMessageBox::Ok).exec();
+		QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n" + tr("Unexpected data read.\nFile is possibly corrupted."));
+		QApplication::restoreOverrideCursor();
 		return false;
 	}
@@ -438,5 +456,7 @@
 	if (version > ZKT_VERSION) {
 		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Load"),tr("Unable to load task:") + "\n" + tr("File version is newer than application supports.\nPlease, try to update application."),QMessageBox::Ok).exec();
+		QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n" + tr("File version is newer than application supports.\nPlease, try to update application."));
+		QApplication::restoreOverrideCursor();
 		return false;
 	}
@@ -448,5 +468,7 @@
 	if ((size < 3) || (size > 5)) {
 		QApplication::restoreOverrideCursor();
-		QMessageBox(QMessageBox::Critical,tr("Task Load"),tr("Unable to load task:") + "\n" + tr("Unexpected data read.\nFile is possibly corrupted."),QMessageBox::Ok).exec();
+		QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
+		QMessageBox::critical(QApplication::activeWindow(), tr("Task Load"), tr("Unable to load task:") + "\n" + tr("Unexpected data read.\nFile is possibly corrupted."));
+		QApplication::restoreOverrideCursor();
 		return false;
 	}
