From f7efbae117595c2503ca85bfca7f27e0b6a92328 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 6 Aug 2013 07:34:45 +0200 Subject: Mac: make windows not restorable on 10.7 and later The default value for NSWindow::setRestorable: is true, it means application will have some information for each window stored. After a crash happened and application relaunched, the application tries to restore those windows from the broken file. And then the "Retore Windows" will pop up. There is no workaround for application users or develoeprs. What they can do is to manually remove the the saved application state file for the application. To avoid that, better to switch it off. Task-number: QTBUG-28281 Change-Id: I4cc81b51b157139ff5e299e85a9bbce05f544219 (cherry-modified from qtbase commit 2aef22b77aa15eb0863a9585af77ccab04425dbd) Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/cocoa/qcocoawindow.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 3a9d28b..fab9419 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -67,6 +67,11 @@ QCocoaWindow::QCocoaWindow(QWidget *tlw) [m_nsWindow makeKeyAndOrderFront:nil]; [m_nsWindow setAcceptsMouseMovedEvents:YES]; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if ([m_nsWindow respondsToSelector:@selector(setRestorable:)]) + [m_nsWindow setRestorable: NO]; +#endif } QCocoaWindow::~QCocoaWindow() -- cgit v0.12