[pan2/testing: 140/279] hopefully fixed segfault with task-weak-ordering.h
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 140/279] hopefully fixed segfault with task-weak-ordering.h
- Date: Sat, 3 Dec 2011 22:33:56 +0000 (UTC)
commit daf5a5fe6fedb80cba81d19a517fec2430fd41aa
Author: Heinrich Mueller <sphemuel stud informatik uni-erlangen de>
Date: Fri Jul 1 19:15:43 2011 +0200
hopefully fixed segfault with task-weak-ordering.h
README.windows | 15 ---------------
pan/tasks/task-weak-ordering.h | 19 ++++++++++++-------
2 files changed, 12 insertions(+), 22 deletions(-)
---
diff --git a/pan/tasks/task-weak-ordering.h b/pan/tasks/task-weak-ordering.h
index 118fe12..bf8b941 100644
--- a/pan/tasks/task-weak-ordering.h
+++ b/pan/tasks/task-weak-ordering.h
@@ -34,14 +34,15 @@ namespace pan
*/
struct TaskWeakOrdering
{
- const Quark BODIES, CANCEL, GROUPS, POST, SAVE, XOVER;
+ const Quark BODIES, CANCEL, GROUPS, POST, SAVE, XOVER, UPLOAD;
TaskWeakOrdering ():
BODIES ("BODIES"),
CANCEL ("CANCEL"),
GROUPS ("GROUPS"),
POST ("POST"),
SAVE ("SAVE"),
- XOVER ("XOVER")
+ XOVER ("XOVER"),
+ UPLOAD ("UPLOAD")
{}
int get_rank_for_type (const Quark& type) const
@@ -54,8 +55,8 @@ namespace pan
rank = 1;
else if (type==SAVE)
rank = 2;
- else
- rank = 2;
+ else if (type==UPLOAD)
+ rank = 3;
return rank;
}
@@ -70,10 +71,14 @@ namespace pan
if (a_rank != b_rank)
return a_rank < b_rank;
- ///DBG segfault (??)
if (a_type == SAVE) { // order 'save' by oldest
- const time_t a_time (dynamic_cast<const TaskArticle*>(a)->get_time_posted ());
- const time_t b_time (dynamic_cast<const TaskArticle*>(b)->get_time_posted ());
+ const TaskArticle* _a = dynamic_cast<const TaskArticle*>(a);
+ const TaskArticle* _b = dynamic_cast<const TaskArticle*>(b);
+
+ if (!_a || !_b) return false;
+
+ const time_t a_time (_a->get_time_posted ());
+ const time_t b_time (_b->get_time_posted ());
if (a_time != b_time)
return a_time < b_time;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]