Bug in KAction::initPrivate

Martijn Klingens klingens at kde.org
Tue Sep 24 21:25:23 BST 2002

On Tuesday 24 September 2002 19:59, Michael Brade wrote:
> revision 1.278
> date: 2002/07/01 21:30:38;  author: hausmann;  state: Exp;  lines: +0 -6
> @@ -1923,8 +1923,6 @@ KListAction::KListAction( const QString&
>  : KSelectAction( text, cut, parent, name )
>  {
>    d = new KListActionPrivate;
> -  if ( receiver )
> -    connect( this, SIGNAL(activated(int)), receiver, slot );
> ----
> So it wasn't your change, Ellis, but Simons. Simon, any explanation for
> breaking my app? ;-))

Yeah... Further up the inheritance chain KAction also connects to receiver. 
The result is that the selected signal is fired off twice, resulting in very 
weird reactions of the code.

One way to solve this is to connect to receiver if and only if receiver takes 
an int, and in that case NOT pas receiver to parent's ctor.

More clean to me seems to not pass the receiver to the parent anyway and do 
all the connecting in KListAction's ctor. Even then we need to detect whether 
the passed receiver takes a parameter or not though.

Simon, any other ideas and/or opinions?

More information about the kde-core-devel mailing list