radioapp/radiouiengine/src/radiostation_p.cpp
changeset 32 189d20c34778
parent 13 46974bebc798
child 36 ba22309243a1
--- a/radioapp/radiouiengine/src/radiostation_p.cpp	Fri Jun 11 13:38:32 2010 +0300
+++ b/radioapp/radiouiengine/src/radiostation_p.cpp	Wed Jun 23 18:12:57 2010 +0300
@@ -26,14 +26,36 @@
 RadioStationPrivate::RadioStationPrivate( int presetIndex, uint frequency )
 {
     init( presetIndex, frequency );
+
+    if ( presetIndex == RadioStation::SharedNull ) {
+        ref = 2;
+    }
 }
 
 /*!
  *
  */
-RadioStationPrivate::RadioStationPrivate( RadioStation::PresetFlag flag )
+RadioStationPrivate::RadioStationPrivate( const RadioStationPrivate& other ) :
+    QSharedData( other ),
+    mPresetIndex( other.mPresetIndex ),
+    mFrequency( other.mFrequency ),
+    mName( other.mName ),
+    mRenamedByUser( other.mRenamedByUser ),
+    mGenre( other.mGenre ),
+    mUrl( other.mUrl ),
+    mPiCode( other.mPiCode ),
+    mType( other.mType ),
+    mPsType( other.mPsType ),
+    mRadioText( other.mRadioText ),
+    mDynamicPsText( other.mDynamicPsText ),
+    mChangeFlags( other.mChangeFlags ),
+    mCallSignCheckDone( other.mCallSignCheckDone ),
+    mLastPsNameChangeTime( other.mLastPsNameChangeTime )
 {
-    init( flag );
+    // Protect the shared null preset index to make debugging easier
+    if ( mPresetIndex == RadioStation::SharedNull ) {
+        mPresetIndex = RadioStation::Invalid;
+    }
 }
 
 /*!
@@ -48,9 +70,8 @@
  */
 void RadioStationPrivate::init( int presetIndex, uint frequency )
 {
-    ref                = 1;
+    mPresetIndex       = presetIndex;
     mFrequency         = frequency;
-    mPresetIndex       = presetIndex;
     mRenamedByUser     = false;
     mGenre             = -1;
     mPiCode            = -1;