1

もともと、オブジェクト 0x6ad4590 の malloc: error: double freeエラーという厄介な漠然としたエラーが発生しました。
次に、この投稿のアドバイスに従い、より有用なエラーを取得しました: -[CFString release]: message sent to deallocated instance and the following trace stack:

Alloc: Block address: 0x40bd6fe0 length: 32
Stack - pthread: 0xac4292c0 number of frames: 35
0: 0x34d22 in GMmalloc_zone_malloc_internal
1: 0x34ebb in GMmalloc_zone_malloc
2: 0x1610a88 in __CFAllocatorSystemAllocate
3: 0x1610a63 in CFAllocatorAllocate
4: 0x16108de in _CFRuntimeCreateInstance
5: 0x1612d13 in __CFStringCreateImmutableFunnel3
6: 0x161a4be in CFStringCreateWithBytes
7: 0xa6da69 in -[NSPlaceholderString initWithBytes:length:encoding:]
8: 0xa6d9bc in +[NSString stringWithUTF8String:]
9: 0x67e9 in -[GDataXMLNode stringFromXMLString:] at/Users/MyUserName/MyDirectory/MyApp/MyApp/GDataXMLNode.m:372
10: 0x6b27 in -[GDataXMLNode stringValue] at/Users/MyUserName/MyDirectory/MyApp/MyApp/GDataXMLNode.m:434
11: 0x165b4 in -[MyTableViewController continueGetSOAPData] at/Users/MyUserName/MyDirectory/MyApp/MyApp/../MyTableViewController.m:295
12: 0x17f53 in -[FVDashViewController connectionDidFinishLoading:] at/Users/MyUserName/MyDirectory/MyApp/MyApp/../MyTableViewController.m:582
13: 0xb70a49 in ___NSURLConnectionDidFinishLoading_block_invoke_0
14: 0xb6ee84 in __65-[NSURLConnectionInternal_withConnectionAndDelegate:onlyActive:]_block_invoke_0
15: 0xb6fea7 in -[NSURLConnectionInternalConnection invokeForDelegate:]
16: 0xb6ee3f in -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
17: 0xb6efc5 in -[NSURLConnectionInternal _withActiveConnectionAndDelegate:]
18: 0xab3f5a in _NSURLConnectionDidFinishLoading
19: 0x3cdfa39 in_ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE
20: 0x3dac596 in_ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20ConnectionEventInfoI12XClientEvent18XClientEventParamsEl
21: 0x3dac861 in _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl
22: 0x3cd6120 in _ZN19URLConnectionClient13processEventsEv
23: 0x3dac117 in _ZThn52_N25URLConnectionInstanceData24multiplexerClientPerformEv
24: 0x3cd5fbf in _ZN17MultiplexerSource7performEv
25: 0x16e094f in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
26: 0x1643b43 in __CFRunLoopDoSources0
27: 0x1643424 in __CFRunLoopRun
28: 0x1642d84 in CFRunLoopRunSpecific
29: 0x1642c9b in CFRunLoopRunInMode
30: 0x15f57d8 in GSEventRunModal
31: 0x15f588a in GSEventRun
32: 0x16d626 in UIApplicationMain
33: 0x3e65 in main at /Users/MyUserName/MyDirectory/MyApp/MyApp/main.m:16
34: 0x24d5 in start

私はデバッグがあまり得意ではないので、これをどうすればよいかわかりません。興味深いことに、トレース スタックの 10 行目にある GDataXMLNode stringValue の呼び出しに対応するコードの行は、NSLog ステートメントです。

NSLog(@"Element Name: %@", element.stringValue);

この行をコメントアウトするとエラーは消えますが、ここにはマスクされているだけの大きな問題があると思います。どんな助けでも大歓迎です!

****編集**** GDataXMLNode.h 内の関連する関数は次のとおりです (トレース スタックの行 #9 に対応):

// returns an autoreleased NSString*, from the current node's document strings
// cache if possible
- (NSString *)stringFromXMLString:(const xmlChar *)chars {

#if DEBUG NSCAssert(chars != NULL, @"GDataXMLNode sees an unexpected empty string");
#endif
if (chars == NULL) return nil;

  CFMutableDictionaryRef cacheDict = NULL;

  NSString *result = nil;

  if (xmlNode_ != NULL
    && (xmlNode_->type == XML_ELEMENT_NODE
        || xmlNode_->type == XML_ATTRIBUTE_NODE
        || xmlNode_->type == XML_TEXT_NODE)) {
    // there is no xmlDocPtr in XML_NAMESPACE_DECL nodes,
    // so we can't cache the text of those

    // look for a strings cache in the document
    //
    // the cache is in the document's user-defined _private field

    if (xmlNode_->doc != NULL) {

      cacheDict = xmlNode_->doc->_private;

      if (cacheDict) {

        // this document has a strings cache
        result = (__bridge_transfer NSString *) CFDictionaryGetValue(cacheDict, chars);
        if (result) {
          // we found the xmlChar string in the cache; return the previously
          // allocated NSString, rather than allocate a new one
          return result;
        }
      }
    }
  }

  // allocate a new NSString for this xmlChar*
  result = [NSString stringWithUTF8String:(const char *) chars];
  if (cacheDict) {
    // save the string in the document's string cache
    CFDictionarySetValue(cacheDict, chars, (__bridge_retained const void *) result);
  }

  return result;
}

また、トレース スタックを参照すると、問題を引き起こしているように見えるのは、上記の関数の次の行です (トレース スタックの行 #8 を参照)。

      result = [NSString stringWithUTF8String:(const char *) chars];
4

0 に答える 0