fix for assert

Milian Wolff mail at milianw.de
Mon Nov 23 22:59:00 UTC 2009


On Friday 20 November 2009 10:28:58 Andrea Nicotra wrote:
> hi, I want give mi contribute to kdevelop bugfix and develop .
> 
> today I found an assert on startup
> 
> ASSERT: "doc" in file
> /home/andrea/workspace/svn/kdevplatform/shell/documentationcontroller.cpp,
> line 132

Hello Andrea!

Sorry, but your patch is not a "fix". We use Q_ASSERT in places where the 
programmer assumes that the expression has to evaluate to true. If not, than 
his algorithm is potentially broken or there is a bug /somewhere else/.

E.g. below Apol (who probably wrote the code) assumes that every plugin he 
gets should inherit the IDocumentationProvider. If not, than something is 
broken and should be fixed there. You should debug this and see which plugin 
cannot be casted.

> --- svn/kdevplatform/shell/documentationcontroller.cpp   (revisione
>  1051795) +++svn/kdevplatform/shell/documentationcontroller.cpp   (copia
>  locale) @@ -129,8 +129,10 @@
>      foreach(IPlugin* p, plugins)
>      {
>          IDocumentationProvider
> *doc=dynamic_cast<IDocumentationProvider*>(p);
> -        Q_ASSERT(doc);
> -        ret.append(doc);
> +       if(doc) {
> +               Q_ASSERT(doc);
> +               ret.append(doc);
> +       }
>      }
>      return ret;
>  }
> 

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20091123/3df78e13/attachment.sig>


More information about the KDevelop-devel mailing list