mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-11-04 09:42:42 +01:00 
			
		
		
		
	fix segfault when stopping JACK2 server
This commit is contained in:
		@@ -5,7 +5,7 @@ project(
 | 
				
			|||||||
    meson_version: '>= 0.49.0',
 | 
					    meson_version: '>= 0.49.0',
 | 
				
			||||||
    default_options : [
 | 
					    default_options : [
 | 
				
			||||||
        'cpp_std=c++17',
 | 
					        'cpp_std=c++17',
 | 
				
			||||||
        'buildtype=release',
 | 
					        'buildtype=debug',
 | 
				
			||||||
        'default_library=static'
 | 
					        'default_library=static'
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,8 @@ std::string waybar::modules::JACK::JACKState() {
 | 
				
			|||||||
  proc_t** proctab = readproctab(PROC_FILLSTAT);
 | 
					  proc_t** proctab = readproctab(PROC_FILLSTAT);
 | 
				
			||||||
  for(int i=0; proctab[i]; i++) {
 | 
					  for(int i=0; proctab[i]; i++) {
 | 
				
			||||||
    procname = proctab[i]->cmd;
 | 
					    procname = proctab[i]->cmd;
 | 
				
			||||||
    if(!procname.compare("jackd") || !procname.compare("pipewire"))
 | 
					    if(!procname.compare("jackd") || !procname.compare("jackdbus") ||
 | 
				
			||||||
 | 
					       !procname.compare("pipewire"))
 | 
				
			||||||
      foundJACK = true;
 | 
					      foundJACK = true;
 | 
				
			||||||
    freeproc(proctab[i]);
 | 
					    freeproc(proctab[i]);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -116,8 +117,14 @@ int waybar::modules::JACK::xrun() {
 | 
				
			|||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					** problem: pipewire leaves old client threads hanging around after server
 | 
				
			||||||
 | 
					** is killed. was handling this sloppily by calling pthread_cancel() on the
 | 
				
			||||||
 | 
					** JACK thread but since JACK2 cleans up after itself properly, this call
 | 
				
			||||||
 | 
					** led to segfault when using JACK2. probably best course of action is to
 | 
				
			||||||
 | 
					** submit a bug report to pipewire.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
void waybar::modules::JACK::shutdown() {
 | 
					void waybar::modules::JACK::shutdown() {
 | 
				
			||||||
  pthread_cancel(jack_thread_);
 | 
					 | 
				
			||||||
  client_ = NULL;
 | 
					  client_ = NULL;
 | 
				
			||||||
  state_ = "disconnected";
 | 
					  state_ = "disconnected";
 | 
				
			||||||
  xruns_ = 0;
 | 
					  xruns_ = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user