Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Create and Destroy WebView



On Aug 10, 2007, at 8:05 PM, Rob Keniger wrote:

On Aug 11, 2007, at 9:31 AM, Paul FitzGerald wrote:

I'm wondering about the correct way to build a WebView on-the-fly and how to destroy it when I'm done. I'm currently getting random crashes (only thing in the stack crawl is "longjump" or something like that).

Anyway, This is what I'm doing to create/destroy my WebView. There is not much in the documentation about how to do this.

Create...
NSRect myRect = [[myWindow contentView] frame];
myWebKitView = [[WebView alloc] initWithFrame:myRect frameName:nil groupName:nil];
[[myWindow contentView] addSubview:myWebKitView];
[myWindow setLevel:NSFloatingWindowLevel];
[myWindow makeKeyAndOrderFront:nil];


Destroy...
		[myWebKitView removeFromSuperview];
		myWebKitView = nil;
		[myWindow orderOut:self];	// Hide Window.


Unless you're using garbage collection, you need to release the view because you've alloc'd it:

		[myWebKitView removeFromSuperview];
		[myWebKitView release];

And you should also call "close" on WebView if your minimum version of WebKit is one that has the -[WebView close] method. That's especially important if you are using garbage collection, because the close method triggers work that would otherwise happen when the WebView is deallocated, which is nondeterministic with garbage collection.


    -- Darin

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden
References: 
 >Create and Destroy WebView (From: Paul FitzGerald <email@hidden>)
 >Re: Create and Destroy WebView (From: Rob Keniger <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.