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 {
517517 }
518518}
519519
520impl Drop for MatrixServer {
520impl Drop for InnerServer {
521521 fn drop(&mut self) {
522522 // TODO close all the server buffers.
523 let config = &self.inner.borrow().config;
523 let config = &self.config;
524524 let mut config_borrow = config.borrow_mut();
525525
526526 let mut section = config_borrow
@@ -530,7 +530,7 @@ impl Drop for MatrixServer {
530530 for option_name in
531531 &["homeserver", "autoconnect", "password", "proxy", "username"]
532532 {
533 let option_name = &format!("{}.{}", self.name(), option_name);
533 let option_name = &format!("{}.{}", self.server_name, option_name);
534534 section.free_option(option_name).unwrap_or_else(|_| {
535535 panic!(format!("Can't free option {}", option_name))
536536 });