[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenetwork/kopete/kopete/config/accounts
From:       Martijn Klingens <klingens () kde ! org>
Date:       2003-10-19 22:03:43
[Download RAW message or body]

CVS commit by mklingens: 

Fix a very dangerous dynamic_cast that wasn't checked. (No, it didn't crash
on me, I just came across it, but not checking a dynamic_cast is VERY
dangerous, especially if it's a pointer returned out of our own control in
a plugin.)

CCMAIL: Olivier Goffart <ogoffart@tiscalinet.be>


  M +11 -1     kopeteaccountconfig.cpp   1.7


--- kdenetwork/kopete/kopete/config/accounts/kopeteaccountconfig.cpp  #1.6:1.7
@@ -182,5 +182,15 @@ void KopeteAccountConfig::slotEditAccoun
                 return;
 
-        editDialog->setMainWidget( static_cast<QWidget *>( m_accountWidget ) );
+        // FIXME: Why the #### is EditAccountWidget not a QWidget?!? This sideways casting
+        //        is braindead and error-prone. Looking at MSN the only reason I can see is
+        //        because it allows direct subclassing of designer widgets. But what is
+        //        wrong with embedding the designer widget in an empty QWidget instead?
+        //        Also, if this REALLY has to be a pure class and not a widget, then the
+        //        class should at least be renamed to EditAccountIface instead - Martijn
+        QWidget *w = dynamic_cast<QWidget *>( m_accountWidget );
+        if ( !w )
+                return;
+
+        editDialog->setMainWidget( w );
         if ( editDialog->exec() == QDialog::Accepted )
         {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic