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

Madhusudan C.S madhusudancs at gmail.com
Tue Feb 3 06:56:05 CET 2009

Hi Vladimir,
  I just went through the code as you suggested through gdb.

On Mon, Feb 2, 2009 at 2:30 AM, Vladimir Kuznetsov <ks.vladimir at gmail.com>wrote:

> 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.

These are the results I got. For convenience I am pasting the
method here where the problem is occuring, please forgive :)

StepCore::Solver* WorldModel::swapSolver(StepCore::Solver* solver)
    bool selected = selectionModel()->isSelected(solverIndex());
    bool current = selectionModel()->currentIndex() == solverIndex();
    beginRemoveRows(QModelIndex(), 1, 1);
    StepCore::Solver* oldSolver = _world->removeSolver();
    beginInsertRows(QModelIndex(), 1, 1);
    if(selected) selectionModel()->select(solverIndex(),
    if(current) selectionModel()->setCurrentIndex(solverIndex(),
    emitChanged(true, true);
    return oldSolver;

Everything seems to be fine until first call goes to beginRemoveRows ()
and then to _world->removeSolver(), but the program crashes when
endRemoveRows() is called. Still not sure whats causing it. But I still did
not understand why a new object QModelIndex() was created and passed
to beginRemoveRows. Is that causing some kind of problem? The API
asks to pass the parent index but we pass a newly created index.
Is that all Ok?

Thanks and regards,

Blogs at: www.madhusudancs.info
Official Email ID: madhusudan at madhusudancs.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-edu/attachments/20090203/fd900d6a/attachment.htm 

More information about the kde-edu mailing list