File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3114,11 +3114,17 @@ async fn logout<R: Runtime>(handle: AppHandle<R>) {
31143114 // Lock the state to ensure nothing is added to the DB before restart
31153115 let _guard = STATE . lock ( ) . await ;
31163116
3117- // Delete the current account's profile directory (SQL database)
3117+ // Close the database connection pool BEFORE attempting to delete files
3118+ // This is critical on Windows where open file handles prevent deletion
3119+ account_manager:: close_db_connection ( ) ;
3120+
3121+ // Delete the current account's profile directory (SQL database and MLS data)
31183122 if let Ok ( npub) = account_manager:: get_current_account ( ) {
31193123 if let Ok ( profile_dir) = account_manager:: get_profile_directory ( & handle, & npub) {
31203124 if profile_dir. exists ( ) {
3121- let _ = std:: fs:: remove_dir_all ( & profile_dir) ;
3125+ if let Err ( e) = std:: fs:: remove_dir_all ( & profile_dir) {
3126+ eprintln ! ( "[Logout] Failed to remove profile directory: {}" , e) ;
3127+ }
31223128 }
31233129 }
31243130 }
@@ -3136,7 +3142,7 @@ async fn logout<R: Runtime>(handle: AppHandle<R>) {
31363142 }
31373143 }
31383144
3139- // Delete the MLS folder in AppData
3145+ // Delete the legacy MLS folder in AppData (for backwards compatibility)
31403146 if let Ok ( mls_dir) = handle. path ( ) . resolve ( "mls" , tauri:: path:: BaseDirectory :: AppData ) {
31413147 if mls_dir. exists ( ) {
31423148 let _ = std:: fs:: remove_dir_all ( & mls_dir) ;
You can’t perform that action at this time.
0 commit comments