[umbrello-devel] [umbrello] [Bug 351103] Umbrello crashes when changing type for an operation for a class

Ralf Habacker ralf.habacker at freenet.de
Mon Aug 17 08:28:49 UTC 2015


https://bugs.kde.org/show_bug.cgi?id=351103

--- Comment #9 from Ralf Habacker <ralf.habacker at freenet.de> ---
(In reply to Oliver Kellogg from comment #7)
> (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.
Time to switch to templated base codegenerators using
http://www.grantlee.org/apidox/ as mentioned by Sandros at umbrello development
list ?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list