[kde-edu]: [Repinging] Trying to fix - https://bugs.kde.org/show_bug.cgi?id=178572

Vladimir Kuznetsov ks.vladimir at gmail.com
Sun Feb 1 22:00:10 CET 2009


Hello Madhusudan !

Please forgive me for not replying for so long. I was very busy when I've got 
your mail, and then I've simply forget about it.

On Sunday 01 February 2009 10:09:00 you wrote:
> Hi Vladimir,
>          I had contacted you a month back or so and also had sent this same
> mail 2 weeks back. In reply to the first mail you had given some pointers
> regarding contribution to Step and you had given me a list of things I
> could do for Step. Unfortunately I could not do much because I had to give
> my end sem exams during this time. With last paper left for Monday, 19th
> Jan I thought its time to start working.
> I just took the bug
> https://bugs.kde.org/show_bug.cgi?id=178572
> and started working on it. I just have come down to the core of the problem
> but I am stuck there. Here is the problem and I want some help from you to
> fix it. Kindly help me.
>
> In kdeedu/step/step.worldmodel.cc, in the method QVariant
> WorldModel::data(const QModelIndex &index, int role) const which is an
> implementation of the QAbstractItemModel class's data() method, the index
> that is passed is valid, i.e isValid() returns true but the
> internalPointer() is null. I am just wondering if this possible at all. i.e
> how can index be valid when it points to no data. But some one on #kde-edu
> told its definitely possible, but I did not understand how.
Yes, this is definitely possible. isValid flag informs QT that the index is 
valid, but internalPointer is just a pointer to application-specific data which 
can be anything that application want to store into it. In case of Step that 
pointer is used to store a pointer to relevant StepCore::Object subclass and 
it should not be NULL, so we see a problem with it.

To check why it can be NULL, let's look at a point where the index is created. 
There are several functions in WorldModel which returns QModelIndex, but all 
of them uses WorldModel::solverIndex() function to obtain index for solver 
which in turn calls StepCore::World::solver() function which just returns 
_solver member of the World class.

Next we have to look at where that member (World::_solver) is initialized. 
There is World::setSolver function that sets it and it is called by 
WorldModel::swapSolver function which in turn is called by CommandSetSolver 
class which is created in WorldModel::newSolver function.

You could check using debugger whether WorldModel::newSolver receives a 
correct solver class name as an argument and whether the solver is created 
correctly. Then you could check whether it is correctly passed passed to 
swapSolver function.

But that is only my assumption which can be wrong (today I'm not at home and 
have no access to compiled Step). Please tell me about you results and ideas: 
I hope I'll reply faster this time :-)

> This exactly is causing the bug reported in the above link. Can you help me
> to go about fixing this bug? <madhusudan at madhusudancs.info>


-- 
      Best Regards,
        Vladimir


More information about the kde-edu mailing list