[scribus-dev] Destruction of removed items

Elvis Stansvik elvstone at gmail.com
Sun Aug 14 13:42:29 UTC 2011


Hi again,

The tables listens to changes in the document-wide cell and table
style contexts. They do this by connecting to them like this:

// Listen to changes in the document-wide cell/table style contexts.
m_Doc->tableStyles().connect(this, SLOT(handleStyleChanged()));
m_Doc->cellStyles().connect(this, SLOT(handleStyleChanged()));

during construction, and disconnecting like this:

m_Doc->tableStyles().disconnect(this, SLOT(handleStyleChanged()));
m_Doc->cellStyles().disconnect(this, SLOT(handleStyleChanged()));

on destruction.

In the handleStyleChanged() handler I perform things like updating the
cell text frames. This involves accessing the cells and their styles
(to get border/padding width).

Now, this wouldn't be a problem if it wasn't for the fact that a table
which has been deleted by selecting it and pressing Delete seems to
receive these signals on application exit. And when that happens, it
seems that the internal style objects used by the cells have been
destroyed (I'm guessing maybe by the style context themselves)? At
least that's my understanding. I'll have to do some debugging.

This means that currently we get a crash if tables have been deleted
and the application is exited.

Elvis



More information about the scribus-dev mailing list