Cleaned up object deletion for notifications
This commit is contained in:
		
							parent
							
								
									b3df2985b7
								
							
						
					
					
						commit
						8ceef83f2e
					
				| @ -2181,6 +2181,9 @@ both here.</string> | ||||
|            </item> | ||||
|            <item> | ||||
|             <widget class="QGroupBox" name="azel_path_group_box"> | ||||
|             <property name="visible"> | ||||
|             <bool>false</bool> | ||||
|             </property> | ||||
|              <property name="toolTip"> | ||||
|               <string>AzEl Directory</string> | ||||
|              </property> | ||||
|  | ||||
| @ -18,11 +18,15 @@ NotificationAudio::NotificationAudio(QObject *parent) : | ||||
| NotificationAudio::~NotificationAudio(){ | ||||
|     stop(); | ||||
| 
 | ||||
|     delete m_decoder; | ||||
|     m_decoder = nullptr; | ||||
|     if(m_decoder){ | ||||
|       delete m_decoder; | ||||
|       m_decoder = nullptr; | ||||
|     } | ||||
| 
 | ||||
|     delete m_audio; | ||||
|     m_audio = nullptr; | ||||
|     if(m_audio){ | ||||
|       delete m_audio; | ||||
|       m_audio = nullptr; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| // initialize an audio device
 | ||||
| @ -52,15 +56,11 @@ void NotificationAudio::init(const QAudioDeviceInfo &device, const QAudioFormat& | ||||
| } | ||||
| 
 | ||||
| // play an audio file
 | ||||
| void NotificationAudio::play(const QString &filePath) { | ||||
| void NotificationAudio::play(const QString &filePath){ | ||||
|     if(m_state == NotificationAudio::Playing){ | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     playFile(filePath); | ||||
| } | ||||
| 
 | ||||
| void NotificationAudio::playFile(const QString &filePath){ | ||||
|     if(!m_init || !m_decoder || !m_audio){ | ||||
|         return; | ||||
|     } | ||||
|  | ||||
| @ -49,7 +49,6 @@ private: | ||||
|     bool m_init; | ||||
|     bool m_isDecodingFinished; | ||||
| 
 | ||||
|     void playFile(const QString &filePath); | ||||
|     void resetBuffers(); | ||||
| 
 | ||||
| private slots: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jordan Sherer
						Jordan Sherer