Commit 3040ad0f authored by beidson@apple.com's avatar beidson@apple.com

2009-06-23 Brady Eidson <beidson@apple.com>

        Reviewed by Darin Adler.

        <rdar://problem/6950660> REGRESSION: iSale 5.5.3 crashes after I click a template to load

        Due to some subtle WebKit changes - presumably some delegate callback behavior - a latent bug in 
        iSale was uncovered where they aren't properly retaining their FrameLoadDelegate, and we ended up
        calling back to a dealloc'ed object.

        * WebView/WebView.mm:
        (-[WebView _needsAdobeFrameReloadingQuirk]): Use more intelligent C++-style initialization.
        (-[WebView _needsKeyboardEventDisambiguationQuirks]): Ditto.
        (-[WebView _needsFrameLoadDelegateRetainQuirk]): YES for iSale versions under 5.6
        (-[WebView dealloc]): Release the delegate if the quirk is in effect.
        (-[WebView setFrameLoadDelegate:]): Retain the new delegate if the quirk is in effect.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@45021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2dce36c5
2009-06-23 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler.
<rdar://problem/6950660> REGRESSION: iSale 5.5.3 crashes after I click a template to load
Due to some subtle WebKit changes - presumably some delegate callback behavior - a latent bug in
iSale was uncovered where they aren't properly retaining their FrameLoadDelegate, and we ended up
calling back to a dealloc'ed object.
* WebView/WebView.mm:
(-[WebView _needsAdobeFrameReloadingQuirk]): Use more intelligent C++-style initialization.
(-[WebView _needsKeyboardEventDisambiguationQuirks]): Ditto.
(-[WebView _needsFrameLoadDelegateRetainQuirk]): YES for iSale versions under 5.6
(-[WebView dealloc]): Release the delegate if the quirk is in effect.
(-[WebView setFrameLoadDelegate:]): Retain the new delegate if the quirk is in effect.
2009-06-23 Anders Carlsson <andersca@apple.com>
Reviewed by Darin Adler.
......
......@@ -1200,13 +1200,7 @@ static bool fastDocumentTeardownEnabled()
- (BOOL)_needsAdobeFrameReloadingQuirk
{
static BOOL checked = NO;
static BOOL needsQuirk = NO;
if (checked)
return needsQuirk;
needsQuirk = WKAppVersionCheckLessThan(@"com.adobe.Acrobat", -1, 9.0)
static BOOL needsQuirk = WKAppVersionCheckLessThan(@"com.adobe.Acrobat", -1, 9.0)
|| WKAppVersionCheckLessThan(@"com.adobe.Acrobat.Pro", -1, 9.0)
|| WKAppVersionCheckLessThan(@"com.adobe.Reader", -1, 9.0)
|| WKAppVersionCheckLessThan(@"com.adobe.distiller", -1, 9.0)
......@@ -1216,25 +1210,22 @@ static bool fastDocumentTeardownEnabled()
|| WKAppVersionCheckLessThan(@"com.adobe.InCopy", -1, 5.1)
|| WKAppVersionCheckLessThan(@"com.adobe.InDesign", -1, 5.1)
|| WKAppVersionCheckLessThan(@"com.adobe.Soundbooth", -1, 2);
checked = YES;
return needsQuirk;
}
- (BOOL)_needsKeyboardEventDisambiguationQuirks
{
static BOOL checked = NO;
static BOOL needsQuirks = NO;
if (checked)
return needsQuirks;
needsQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_IE_COMPATIBLE_KEYBOARD_EVENT_DISPATCH) && !applicationIsSafari();
checked = YES;
static BOOL needsQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_IE_COMPATIBLE_KEYBOARD_EVENT_DISPATCH) && !applicationIsSafari();
return needsQuirks;
}
- (BOOL)_needsFrameLoadDelegateRetainQuirk
{
static BOOL needsQuirk = WKAppVersionCheckLessThan(@"com.equinux.iSale5", -1, 5.6);
return needsQuirk;
}
- (void)_preferencesChangedNotification:(NSNotification *)notification
{
WebPreferences *preferences = (WebPreferences *)[notification object];
......@@ -2465,6 +2456,9 @@ static bool needsWebViewInitThreadWorkaround()
--WebViewCount;
if ([self _needsFrameLoadDelegateRetainQuirk])
[_private->frameLoadDelegate release];
[_private release];
// [super dealloc] can end up dispatching against _private (3466082)
_private = nil;
......@@ -2685,6 +2679,15 @@ static bool needsWebViewInitThreadWorkaround()
- (void)setFrameLoadDelegate:delegate
{
// <rdar://problem/6950660> - Due to some subtle WebKit changes - presumably to delegate callback behavior - we've
// unconvered a latent bug in at least one WebKit app where the delegate wasn't properly retained by the app and
// was dealloc'ed before being cleared.
// This is an effort to keep such apps working for now.
if ([self _needsFrameLoadDelegateRetainQuirk]) {
[delegate retain];
[_private->frameLoadDelegate release];
}
_private->frameLoadDelegate = delegate;
[self _cacheFrameLoadDelegateImplementations];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment