[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: kdepim/karm
From: Mark Bucciarelli <mark () hubcapconsulting ! com>
Date: 2003-09-04 23:43:15
[Download RAW message or body]
On Thursday 04 September 2003 4:16 pm, Scott Wheeler wrote:
> CVS commit by wheeler:
>
> Build. Though it hurts me making this change since reimplementing
> fisrstChild() as first_child() is sick and wrong.
Thanks for the cc.
I was getting intermittant null pointer exceptions with the original code.
>From a posting on kde-devel, someone said that gcc has trouble when a method
in a subclass recasts the return type, and the parent class does not
implement (which is the case with firstChild() and KListView).
I'm baffled why it used to work and why a similar method in task.cpp works
fine. Perhaps b/c I'm using gcc 3.2? (Doubt it.)
Anyway, I spent a lot of time in gdb on this one and as best I could figure
it, it's a problem with gcc.
With the original code, the pointer returned pointed to a proper task
structure, but all the variables (for example, task->name()) were null.
I welcome any alternative implementations. I didn't like the solution either
but it was the best I could do to reliably avoid null pointer exceptions.
>
> CCMAIL:mark@hubcapconsulting.com
>
>
> M +4 -4 print.cpp 1.13
>
>
> --- kdepim/karm/print.cpp #1.12:1.13
> @@ -40,7 +40,7 @@ void MyPrinter::print()
> int totalTotal = 0;
> int sessionTotal = 0;
> - for (Task* task = _taskView->firstChild();
> + for (Task* task = _taskView->first_child();
> task;
> - task = task->nextSibling()) {
> + task = static_cast<Task *>(task->nextSibling())) {
> totalTotal += task->time();
> sessionTotal += task->sessionTime();
> @@ -57,5 +57,5 @@ void MyPrinter::print()
> int maxReqNameFieldWidth= metrics.width(i18n("Task Name "));
>
> - for ( Task* task = _taskView->firstChild();
> + for ( Task* task = _taskView->first_child();
> task;
> task = task->nextSibling())
> @@ -93,5 +93,5 @@ void MyPrinter::print()
>
> // Now print the actual content
> - for ( Task* task = _taskView->firstChild();
> + for ( Task* task = _taskView->first_child();
> task;
> task = task->nextSibling() )
--
Mark Bucciarelli, www.hubcapconsulting.com
He who receives an idea from me, receives instruction himself
without lessening mine; as he who lights his taper at mine receives
light without darkening me. -- Thomas Jefferson
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic