Wednesday, September 9, 2009

iWorks '09 Keynote hangs loading a ppt file potentially losing all your work

I had a problem. I'd been working all day on a presentation which I hadn't saved (yea I know). Then I tried to load a powerpoint file and Keynote just hung trying to load the file. If I couldn't get it to unhang I would have lost a days work as Keynote doesn't autosave. The solution is to attach gdb to the Keynote and get it to jump out of whichever loop it's stuck in. Like so:

news-macbook:MacOS new$ ps -ef | grep Keynote
501 13290 82 0 1:22.74 ?? 46:51.60 /Applications/iWork '09/Keynote.app/Contents/MacOS/Keynote -psn_0_1552763
news-macbook:MacOS new$ grep -p 13290
grep: invalid option -- p
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
news-macbook:MacOS new$ gdb -p 13290
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
/Applications/iWork '09/Keynote.app/Contents/MacOS/13290: No such file or directory
Attaching to process 13290.
Reading symbols for shared libraries . done
Reading symbols for shared libraries ................................................................................................................................................................................................................................ done
0x942ed26d in ___CFBasicHashFindBucket1 ()
(gdb) bt
#0 0x942ed26d in ___CFBasicHashFindBucket1 ()
#1 0x942edd5b in CFBasicHashFindBucket ()
#2 0x942edcd4 in -[NSClassicMapTable objectForKey:] ()
#3 0x942edca8 in NSMapGet ()
#4 0x008dcf77 in -[ADReference reference] ()
#5 0x008db594 in -[ADNode firstChildWithName:xmlNamespace:objcClass:resolveReference:] ()
#6 0x008db3d2 in -[ADNode firstChildWith:resolveReference:] ()
#7 0x008db369 in -[ADNode firstChildWith:] ()
#8 0x009036b6 in -[ADSStyleSheet(ADInternal) parentSheet] ()
#9 0x00903f22 in -[ADSStyleSheet(Private) recursiveStyleWithIdentifier:] ()
#10 0x00903613 in -[ADSStyleSheet ensureOwnStyleWithIdentifierExists:] ()
#11 0x005f50a7 in +[PIOGraphicStyleMapper mapMasterStylesFromPptSlide:toStyleSheet:withState:] ()
#12 0x005fbe13 in -[PIOMasterSlideMapper mapMasterStyles] ()
#13 0x005fbf9d in -[PIOMasterSlideMapper map] ()
#14 0x00610ea9 in -[PIOThemeMapper mapMaster:includingGraphics:] ()
#15 0x00610f94 in -[PIOThemeMapper mapMaster:] ()
#16 0x006111b1 in -[PIOThemeMapper mapMasters] ()
#17 0x00611285 in -[PIOThemeMapper map] ()
#18 0x005f28c1 in -[PIODocMapper(Private) mapThemes] ()
#19 0x005f238b in -[PIODocMapper map] ()
#20 0x005f9467 in -[PIOImporter readFromFile:binaryDirectory:templatePath:localizer:] ()
#21 0x0022e0e2 in ?? ()
#22 0x0022e2d0 in ?? ()
#23 0x0022f789 in ?? ()
#24 0x0022ecea in ?? ()
#25 0x000a8c5f in ?? ()
#26 0x000a875f in ?? ()
#27 0x96c08769 in -[NSDocument initWithContentsOfURL:ofType:error:] ()
#28 0x96c0830d in -[NSDocumentController makeDocumentWithContentsOfURL:ofType:error:] ()
#29 0x000163ed in ?? ()
#30 0x00096fb4 in ?? ()
#31 0x02ddac2e in -[SFAppApplicationDelegate(Private) pOpenDocumentWithContentsOfFile:] ()
#32 0x02dd822d in -[SFAppApplicationDelegate application:openFiles:] ()
#33 0x001f7f55 in ?? ()
#34 0x96c0637d in -[NSApplication(NSAppleEventHandling) _handleAEOpenDocumentsForURLs:] ()
#35 0x96b44104 in -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] ()
#36 0x9432346c in -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] ()
#37 0x94323230 in _NSAppleEventManagerGenericHandler ()
#38 0x90905de6 in aeDispatchAppleEvent ()
#39 0x90905ce5 in dispatchEventAndSendReply ()
#40 0x90905bf2 in aeProcessAppleEvent ()
#41 0x9061a381 in AEProcessAppleEvent ()
#42 0x969bddd6 in _DPSNextEvent ()
#43 0x969bd40e in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#44 0x9697f5fb in -[NSApplication run] ()
#45 0x0000f13f in ?? ()
#46 0x0000f0b8 in ?? ()
#47 0x0000ee50 in ?? ()
#48 0x0005cc79 in ?? ()
(gdb) ret
Make selected stack frame return now? (y or n) y


Keep 'ret'ing until you reach 'readFromFile'. At this point type 'c'. Keynote will then tell you it couldn't open the file and you will be able to save your existing document.

1 comment:

Niall Haslam said...

Thats pretty impressive thinking there man. Though seriously - save your work.