Help regarding the code

Aaron J. Seigo aseigo at kde.org
Wed Sep 15 00:31:13 CEST 2010


On Tuesday, September 14, 2010, sujith h wrote:
> Hi,
> 
> I were trying to modify the frame applet in kdeplasma-addons.
> I am having a small issue with the diff attached with the mail(frame.diff).
> The backtrace is also attached with
> the mail(backtrace.txt). My intention is to pass emit the a function in
> slideshow.cppwhen the directory is empty
> to load images and then use the connect in the picture.cpp to write some
> message to the a QString variable.
> In the mean while I am initializing an object of SlideShow class using:
> 
> m_slideshow = new SlideShow(this);
> 
> Should this cause a problem? Pardon me if am wrong.

you have an infinite loop, and youc an see this in the backtrace how it 
alternates between two lines back and forth:

in your patch in Picture::Picture(), there is this:

	m_slideshow = new SlideShow(this);

so Picture creates a SlideShow. but in SlideShow's constructor, there is this:

	m_picture = new Picture(this);

which means Picture creates a Slideshow, which creates a Picture, which 
creates a SlideShow, which creates a ....

you should not create the SlideShow in Picture. instead, right after 
"m_picture = new Picture(this);" in SlideShow, put this line:

	connect(this, SIGNAL(emptyDirMessage()), m_picture, 
SLOT(customizeEmptyMessage()));

that should work much better :)

on a side note, instead of this:

   if( m_picturePaths.size() == 0) {

you can just do:

    if (m_picturePaths.isEmtpy()) {

we find it more readable

also, please be careful to follow the coding style (whitespace, etc) in the 
files you work on.. cheers :)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20100914/9bc39064/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20100914/9bc39064/attachment-0001.sig 


More information about the Plasma-devel mailing list