santhosh
santhosh

Reputation: 1261

App got crashed when i reload the url in cocoa webview

In my cocoa application, I am using WebView to load my URL. For my requirement, I will reload the URL for every 10 minutes. But sometimes, the app got crashed when I am trying to reload. I am using the below code to load the URL in webview.

sample.h

#import <WebKit/WebKit.h>
@property(nonatomic,retain) IBOutlet WebView *webview;

Sample.m

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"www.dummyurl.com"]];
  [self->webview.mainFrame loadRequest:request];

StackTrace:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x00007fff56efeff8

VM Regions Near 0x7fff56efeff8:
    MALLOC_TINY            00007f9e7b000000-00007f9e7b100000 [ 1024K] rw-/rwx SM=ZER  
--> STACK GUARD            00007fff536ff000-00007fff56eff000 [ 56.0M] ---/rwx SM=NUL  stack guard for thread 0
    Stack                  00007fff56eff000-00007fff576ff000 [ 8192K] rw-/rwx SM=COW  thread 0

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.WebCore             0x00007fff90238264 WebCore::RenderObject::containingBlock() const + 4
1   com.apple.WebCore             0x00007fff9036cdaf WebCore::RenderBlock::computeBlockPreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 63
2   com.apple.WebCore             0x00007fff90d0524a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 58
3   com.apple.WebCore             0x00007fff9047eaab WebCore::RenderBox::computeIntrinsicLogicalWidthUsing(WebCore::Length, WebCore::LayoutUnit, WebCore::LayoutUnit) const + 187
4   com.apple.WebCore             0x00007fff9033f8f4 WebCore::RenderBox::computeReplacedLogicalWidthUsing(WebCore::Length) const + 212
5   com.apple.WebCore             0x00007fff9033f707 WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(WebCore::LayoutUnit, WebCore::ShouldComputePreferred) const + 215
6   com.apple.WebCore             0x00007fff9033f572 WebCore::RenderReplaced::computeReplacedLogicalWidth(WebCore::ShouldComputePreferred) const + 1074
7   com.apple.WebCore             0x00007fff9033fcfb WebCore::RenderReplaced::computePreferredLogicalWidths() + 139
8   com.apple.WebCore             0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
9   com.apple.WebCore             0x00007fff90320611 WebCore::RenderBlock::computeInlinePreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 3105
10  com.apple.WebCore             0x00007fff90d0523a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 42
11  com.apple.WebCore             0x00007fff9031f6a4 WebCore::RenderBlock::computePreferredLogicalWidths() + 356
12  com.apple.WebCore             0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
13  com.apple.WebCore             0x00007fff90320611 WebCore::RenderBlock::computeInlinePreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 3105
14  com.apple.WebCore             0x00007fff90d0523a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 42
15  com.apple.WebCore             0x00007fff9031f6a4 WebCore::RenderBlock::computePreferredLogicalWidths() + 356
16  com.apple.WebCore             0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
17  com.apple.WebCore             0x00007fff90320611 WebCore::RenderBlock::computeInlinePreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 3105
18  com.apple.WebCore             0x00007fff90d0523a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 42
19  com.apple.WebCore             0x00007fff9031f6a4 WebCore::RenderBlock::computePreferredLogicalWidths() + 356
20  com.apple.WebCore             0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
21  com.apple.WebCore             0x00007fff9036d07c WebCore::RenderBlock::computeBlockPreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 780
22  com.apple.WebCore             0x00007fff90d0524a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 58
23  com.apple.WebCore             0x00007fff9047eaab WebCore::RenderBox::computeIntrinsicLogicalWidthUsing(WebCore::Length, WebCore::LayoutUnit, WebCore::LayoutUnit) const + 187
24  com.apple.WebCore             0x00007fff9033f8f4 WebCore::RenderBox::computeReplacedLogicalWidthUsing(WebCore::Length) const + 212
25  com.apple.WebCore             0x00007fff9033f707 WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(WebCore::LayoutUnit, WebCore::ShouldComputePreferred) const + 215
26  com.apple.WebCore             0x00007fff9033f572 WebCore::RenderReplaced::computeReplacedLogicalWidth(WebCore::ShouldComputePreferred) const + 1074
27  com.apple.WebCore             0x00007fff9033fcfb WebCore::RenderReplaced::computePreferredLogicalWidths() + 139
28  com.apple.WebCore             0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
29  com.apple.WebCore             0x00007fff90320611 WebCore::RenderBlock::computeInlinePreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 3105 

Anyone please provide the solution to resolve this issue?

PS : I am using ARC in my project.

Upvotes: 0

Views: 161

Answers (1)

MoLowKey
MoLowKey

Reputation: 1144

i suggest you set exception breakpoint to find exact problem with your code , but i hope your problem is Released object i think your UIWebView or Url become to nil. please use strong property for your objects. can you show a little of your code ? do you use custom webview or custom webkit ?

Upvotes: 1

Related Questions