Bug 50391 - completed() signal wont be emitted on playing second file, under certain circumstances
Summary: completed() signal wont be emitted on playing second file, under certain circ...
Status: RESOLVED FIXED
Alias: None
Product: kaboodle
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Neil Stevens
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-08 06:34 UTC by zakariya
Modified: 2002-12-06 15:48 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zakariya 2002-11-08 06:34:09 UTC
Version:           1.6 (KDE 3.1 RC2) (using KDE KDE 3.0.9)
Installed from:    Compiled From Sources
Compiler:          gcc 2.95.3 
OS:          Linux

I apologize in advance for the odd circumstances of this bug. 

Anyway, I'm writing a lightweight media player and had much trouble using a dynamically loaded kaboodle component. The component worked, but for the life of me I was unable to capture state changes of KMediaPlayer::Player::State to notify my playlist to load the next file. So, with a grimace, I copied the code from kaboodle for the Player and Engine classes and whittled them down to do what I need them to do.

Now, in doing so, I found an interesting bug. In the method

snip:

Kaboodle::Player::tickerTimeout()
{
	if(engine->state() == Stop)
	{
		if ( uncompleted )
 		{
			stop();
			if( isLooping() )
			{
				play();
			}
			else
			{
				emit completed();
				uncompleted = false;
			}
		}
	}

Notice the lines:
	emit completed()
	uncompleted = false;

This is the source of much hair pulling on my part. If somebody were to connect the completed() signal to some logic which were to then call openURL() with a new file and then play(), the variable uncompleted will be set to true in play() but then back to false when the signal completed() returns. So, you'll have a playing track, but uncompleted will be false. So, when this track finishes, completed() will not be emitted.

All I did to fix it was to switch the two lines.
Comment 1 Neil Stevens 2002-11-27 20:53:27 UTC
I'll try to test this today. 
Comment 2 Neil Stevens 2002-12-06 15:48:59 UTC
One week and a bad cold later, I test it, and everything works fine.  This change 
should be in KDE 3.1 whenever it comes out. 
 
Thanks... that completed signal was written for Kaboodle's quit on finished playing 
option, so it never got the kind of testing you've since done. :-)