From b9a2d6c138a477092ea63b209ed00f8bf47e331b Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 17 Nov 2017 17:26:13 +0100 Subject: Fix a rare timing-sensitive crash when closing a window during a connection attempt (part of #2924) --- Source/SPDatabaseDocument.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 2581967c..6091ed3b 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -6534,8 +6534,11 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; if (processListController) [processListController close]; + // #2924: The connection controller doesn't retain its delegate (us), but it may outlive us (e.g. when running a bg thread) + [connectionController setDelegate:nil]; + SPClear(connectionController); + if (selectedTableName) SPClear(selectedTableName); - if (connectionController) SPClear(connectionController); if (processListController) SPClear(processListController); if (serverVariablesController) SPClear(serverVariablesController); if (mySQLConnection) SPClear(mySQLConnection); -- cgit v1.2.3