From 332f6201ce607a6622fadfd3e6426e4571dc035f Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 16 Mar 2010 02:04:50 +0000 Subject: - Make a number of changes to attempt to improve disconnection/quit crashes: prevent multiple disconnects, add more checks, cancel current queries, and add a tiny delay to allow mysql cleanup. - Alter MCPStreamingResult to no longer return a retained instance, setting up correct result disposal on autorelease but changing callers to retain as soon as they receive. - Review and change a number of local variables shadowing/shielding other local or global variables. --- Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m index 624f132c..fd7d181b 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m @@ -95,6 +95,10 @@ mNumOfFields = 0; } + // Obtain SEL references and pointer + isConnectedSEL = @selector(isConnected); + isConnectedPtr = [parentConnection methodForSelector:isConnectedSEL]; + // If the result is opened in download-data-fast safe mode, set up the additional variables // and threads required. if (!fullyStreaming) { @@ -127,6 +131,7 @@ */ - (void) dealloc { + [self cancelResultLoad]; if (!connectionUnlocked) [parentConnection unlockConnection]; if (!fullyStreaming) { @@ -406,7 +411,7 @@ size_t sizeOfDataLengths = (size_t)(sizeof(unsigned long) * mNumOfFields); // Loop through the rows until the end of the data is reached - indicated via a NULL - while (theRow = mysql_fetch_row(mResult)) { + while ( (BOOL)(*isConnectedPtr)(parentConnection, isConnectedSEL) && (theRow = mysql_fetch_row(mResult))) { // Retrieve the lengths of the returned data fieldLengths = mysql_fetch_lengths(mResult); -- cgit v1.2.3