[umbrello-devel] [umbrello] [Bug 351103] Umbrello crashes when changing type for an operation for a class
Oliver Kellogg
okellogg at users.sourceforge.net
Fri Aug 14 21:54:39 UTC 2015
https://bugs.kde.org/show_bug.cgi?id=351103
Oliver Kellogg <okellogg at users.sourceforge.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |okellogg at users.sourceforge.
| |net
--- Comment #7 from Oliver Kellogg <okellogg at users.sourceforge.net> ---
(In reply to Challistobugs from comment #2)
> [...]
> I was changing the return type of an operation in a class.
Hmm let's see...
CodeMethodBlock inherits from OwnedCodeBlock,
class CodeMethodBlock : public OwnedCodeBlock, [...]
and declares
public slots:
virtual void syncToParent();
However, the actual "connect" of this syncToParent() is not done in
CodeMethodBlock but rather in the parent class OwnedCodeBlock,
void OwnedCodeBlock::initFields(UMLObject * parent)
{
[...]
connect(m_parentObject, SIGNAL(modified()), this,
SLOT(syncToParent()));
}
The problem is that OwnedCodeBlock::initFields() is called from within the
OwnedCodeBlock constructor,
OwnedCodeBlock::OwnedCodeBlock (UMLObject * parent)
: QObject (parent)
{
setObjectName(QLatin1String("anOwnedCodeBlock"));
initFields(parent);
}
which itself is called by the CodeMethodBlock constructor,
CodeMethodBlock::CodeMethodBlock(ClassifierCodeDocument * doc, UMLObject *
parentObj,
const QString & body, const QString
& comment)
: OwnedCodeBlock (parentObj), [...]
which means that the connect() is done on a CodeMethodBlock object which itself
is not yet fully constructed: vtbl_ptr not yet initialized, dynamic method
dispatch to child class not possible.
By the way, the new code generators had this design error all over the place.
Years ago, I tried to fix the many occurrences of this pattern but gave up at
some point.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the umbrello-devel
mailing list