diff options
author | stuconnolly <stuart02@gmail.com> | 2010-05-26 15:05:48 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-05-26 15:05:48 +0000 |
commit | f36df95c5c983e255f9c4ab79b76c3e4a132a974 (patch) | |
tree | 2d9b61735f9d1c3c9c1b0a59cee5cd3e6ed0d8f9 | |
parent | 64307838194fd153b88df82156a7fad3ff68de4c (diff) | |
download | sequelpro-f36df95c5c983e255f9c4ab79b76c3e4a132a974.tar.gz sequelpro-f36df95c5c983e255f9c4ab79b76c3e4a132a974.tar.bz2 sequelpro-f36df95c5c983e255f9c4ab79b76c3e4a132a974.zip |
Data export fixes:
- Fix the same potential autorelease pool memory leak found in the CSV exporter in the XML exporter.
- When performing an XML export to a single file don't write the header twice.
- Remember to append the .xml extension when performing an XML export to a single file.
-rw-r--r-- | Source/SPExportInitializer.m | 5 | ||||
-rw-r--r-- | Source/SPXMLExporter.m | 10 |
2 files changed, 6 insertions, 9 deletions
diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index 0ceccbd6..20b38c5e 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -355,9 +355,6 @@ } singleFileHandle = [self getFileHandleForFilePath:[[exportPathField stringValue] stringByAppendingPathComponent:[filename stringByAppendingPathExtension:@"xml"]]]; - - // Write the file header - [self writeXMLHeaderToFileHandle:singleFileHandle]; } // Start the export process depending on the data source @@ -541,7 +538,7 @@ if ((exportSource == SPTableExport) && exportToMultipleFiles && (exportTableCount > 0)) { filename = [[exportPathField stringValue] stringByAppendingPathComponent:table]; - fileHandle = [self getFileHandleForFilePath:filename]; + fileHandle = [self getFileHandleForFilePath:[filename stringByAppendingPathExtension:@"xml"]]; // Write the file header [self writeXMLHeaderToFileHandle:fileHandle]; diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m index 94cfec05..de43560e 100644 --- a/Source/SPXMLExporter.m +++ b/Source/SPXMLExporter.m @@ -60,7 +60,6 @@ { @try { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSAutoreleasePool *xmlExportPool = [[NSAutoreleasePool alloc] init]; NSArray *xmlRow = nil; NSString *dataConversionString = nil; @@ -121,7 +120,7 @@ if ([self xmlDataArray]) currentRowIndex++; // Drop into the processing loop - xmlExportPool = [[NSAutoreleasePool alloc] init]; + NSAutoreleasePool *xmlExportPool = [[NSAutoreleasePool alloc] init]; currentPoolDataLength = 0; @@ -217,14 +216,14 @@ // Inform the delegate that the export's progress has been updated [delegate performSelectorOnMainThread:@selector(xmlExportProcessProgressUpdated:) withObject:self waitUntilDone:NO]; - // If an array was supplied and we've processed all rows, break - if ([self xmlDataArray] && totalRows == currentRowIndex) break; - // Drain the autorelease pool as required to keep memory usage low if (currentPoolDataLength > 250000) { [xmlExportPool release]; xmlExportPool = [[NSAutoreleasePool alloc] init]; } + + // If an array was supplied and we've processed all rows, break + if ([self xmlDataArray] && totalRows == currentRowIndex) break; } // Write the closing tag for the table @@ -239,6 +238,7 @@ // Inform the delegate that the export process is complete [delegate performSelectorOnMainThread:@selector(xmlExportProcessComplete:) withObject:self waitUntilDone:NO]; + [xmlExportPool release]; [pool release]; } @catch (NSException *e) { } |