Commit 32d9d00a7d

32d9d00a7d748fde4c7c3aff0b701c5bfa05733f

parent: 39592eab8e

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2020-10-15 18:24 UTC

server: Free the config only when we drop the inner server.

Layout: unified · split

src/server.rs +3 −3
@@ -517,10 +517,10 @@ impl MatrixServer {
517 } 517 }
518} 518}
519 519
520impl Drop for MatrixServer { 520impl Drop for InnerServer {
521 fn drop(&mut self) { 521 fn drop(&mut self) {
522 // TODO close all the server buffers. 522 // TODO close all the server buffers.
523 let config = &self.inner.borrow().config; 523 let config = &self.config;
524 let mut config_borrow = config.borrow_mut(); 524 let mut config_borrow = config.borrow_mut();
525 525
526 let mut section = config_borrow 526 let mut section = config_borrow
@@ -530,7 +530,7 @@ impl Drop for MatrixServer {
530 for option_name in 530 for option_name in
531 &["homeserver", "autoconnect", "password", "proxy", "username"] 531 &["homeserver", "autoconnect", "password", "proxy", "username"]
532 { 532 {
533 let option_name = &format!("{}.{}", self.name(), option_name); 533 let option_name = &format!("{}.{}", self.server_name, option_name);
534 section.free_option(option_name).unwrap_or_else(|_| { 534 section.free_option(option_name).unwrap_or_else(|_| {
535 panic!(format!("Can't free option {}", option_name)) 535 panic!(format!("Can't free option {}", option_name))
536 }); 536 });