forked from quickshell/quickshell
		
	core: fix UAF when calling Qt.quit or Qt.exit
A pointer to the last generation had shutdown() called on it after deletion.
This commit is contained in:
		
							parent
							
								
									e327d6750d
								
							
						
					
					
						commit
						9967e2e03b
					
				
					 2 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -96,6 +96,7 @@ void RootWrapper::reloadGraph(bool hard) {
 | 
			
		|||
	generation->onReload(hard ? nullptr : this->generation);
 | 
			
		||||
 | 
			
		||||
	if (hard && this->generation != nullptr) {
 | 
			
		||||
		QObject::disconnect(this->generation, nullptr, this, nullptr);
 | 
			
		||||
		this->generation->destroy();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -103,6 +104,7 @@ void RootWrapper::reloadGraph(bool hard) {
 | 
			
		|||
 | 
			
		||||
	qInfo() << "Configuration Loaded";
 | 
			
		||||
 | 
			
		||||
	QObject::connect(this->generation, &QObject::destroyed, this, &RootWrapper::generationDestroyed);
 | 
			
		||||
	QObject::connect(
 | 
			
		||||
	    this->generation,
 | 
			
		||||
	    &EngineGeneration::filesChanged,
 | 
			
		||||
| 
						 | 
				
			
			@ -117,6 +119,8 @@ void RootWrapper::reloadGraph(bool hard) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RootWrapper::generationDestroyed() { this->generation = nullptr; }
 | 
			
		||||
 | 
			
		||||
void RootWrapper::onWatchFilesChanged() {
 | 
			
		||||
	auto watchFiles = QuickshellSettings::instance()->watchFiles();
 | 
			
		||||
	if (this->generation != nullptr) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,7 @@ public:
 | 
			
		|||
	void reloadGraph(bool hard);
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
	void generationDestroyed();
 | 
			
		||||
	void onWatchFilesChanged();
 | 
			
		||||
	void onWatchedFilesChanged();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue