Mac: Fix crash on 10.6 when building with the 10.7 SDK (issue #1026).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1547@1326 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-07-22 17:04:51 +00:00
parent 2d55b697a0
commit cb0746a88f
2 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
Index: render_widget_host_view_mac.mm
===================================================================
--- render_widget_host_view_mac.mm (revision 211613)
+++ render_widget_host_view_mac.mm (working copy)
@@ -2380,13 +2380,20 @@
NSNotificationCenter* notificationCenter =
[NSNotificationCenter defaultCenter];
+
+ // Backing property notifications crash on 10.6 when building with the 10.7
+ // SDK, see http://crbug.com/260595.
+ BOOL supportsBackingPropertiesNotification = base::mac::IsOSLionOrLater();
+
if (oldWindow) {
+ if (supportsBackingPropertiesNotification) {
+ [notificationCenter
+ removeObserver:self
+ name:NSWindowDidChangeBackingPropertiesNotification
+ object:oldWindow];
+ }
[notificationCenter
removeObserver:self
- name:NSWindowDidChangeBackingPropertiesNotification
- object:oldWindow];
- [notificationCenter
- removeObserver:self
name:NSWindowDidMoveNotification
object:oldWindow];
[notificationCenter
@@ -2395,13 +2402,15 @@
object:oldWindow];
}
if (newWindow) {
+ if (supportsBackingPropertiesNotification) {
+ [notificationCenter
+ addObserver:self
+ selector:@selector(windowDidChangeBackingProperties:)
+ name:NSWindowDidChangeBackingPropertiesNotification
+ object:newWindow];
+ }
[notificationCenter
addObserver:self
- selector:@selector(windowDidChangeBackingProperties:)
- name:NSWindowDidChangeBackingPropertiesNotification
- object:newWindow];
- [notificationCenter
- addObserver:self
selector:@selector(windowChangedGlobalFrame:)
name:NSWindowDidMoveNotification
object:newWindow];