OpenStudioApplication icon indicating copy to clipboard operation
OpenStudioApplication copied to clipboard

Model always shows modified on Mac

Open macumber opened this issue 5 years ago • 8 comments

Current Behavior

The modified * always shows next to the model on Mac

Expected Behavior

The model should not show as modified after saving

Steps to Reproduce

Create a model on Mac, hit save, model shows modified

Environment

Some additional details about your environment for this issue (if relevant):

  • Mac
  • 1.1.0-alpha+beda47b988

macumber avatar Sep 16 '20 03:09 macumber

@macumber I know I've touched this behavior a long time ago. The idea was that you could always click "Revert to Saved". Have you tested on another platform?

jmarrec avatar Sep 17 '20 07:09 jmarrec

We don't set revert to saved off any more, it's always available:

https://github.com/openstudiocoalition/OpenStudioApplication/blob/17d62810bd4991178dfd667e80673cdb85bc9d93/src/openstudio_lib/MainMenu.cpp#L251

My guess is some order of signals is happening differently on Mac, I'm not sure if this is new or not

macumber avatar Sep 18 '20 00:09 macumber

I did confirm yesterday after writing this that ubuntu isn't affected. Once I hit save the * goes away

jmarrec avatar Sep 18 '20 05:09 jmarrec

I get the same behaviour on a Mac (Catalina 10.15.7 (19H2)). * always there, regardless if project is saved or not.

rd2 avatar Oct 07 '20 12:10 rd2

Not hitting this with current develop on a mac M1. Closing until someone says differently.

jmarrec avatar May 03 '22 19:05 jmarrec

I actually ran into this today. Happens when you save the model for the first time (when using "open" I don't seem to get it)

jmarrec avatar May 04 '22 19:05 jmarrec

Hum, I'm seeing a ton of calls to QCocoa. eg this happens when I merely click on a MainMenu item:

Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 3.4
    frame #0: 0x000000010b0496fc libqcocoa.dylib`non-virtual thunk to QCocoaWindow::setWindowModified(bool) [inlined] QCocoaWindow::isContentView(this=<unavailable>) const at qcocoawindow.mm:1470:12 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 3.4
  * frame #0: 0x000000010b0496fc libqcocoa.dylib`non-virtual thunk to QCocoaWindow::setWindowModified(bool) [inlined] QCocoaWindow::isContentView(this=<unavailable>) const at qcocoawindow.mm:1470:12 [opt]
    frame #1: 0x000000010b0496fc libqcocoa.dylib`non-virtual thunk to QCocoaWindow::setWindowModified(bool) [inlined] QCocoaWindow::setWindowModified(this=<unavailable>, modified=<unavailable>) at qcocoawindow.mm:1741:10 [opt]
    frame #2: 0x000000010b0496fc libqcocoa.dylib`non-virtual thunk to QCocoaWindow::setWindowModified(bool) at qcocoawindow.mm:0 [opt]
    frame #3: 0x000000010a19fad8 QtWidgets`QWidgetPrivate::setWindowModified_helper(this=0x000000010add01e0) at qwidget.cpp:11407:26 [opt]
    frame #4: 0x000000010a19ef18 QtWidgets`QWidgetPrivate::create(this=0x000000010add01e0) at qwidget.cpp:1346:5 [opt]
    frame #5: 0x000000010a19db80 QtWidgets`QWidget::create(this=0x0000600000d7daa0, window=<unavailable>, initializeWindow=<unavailable>, destroyOldWindow=<unavailable>) at qwidget.cpp:1182:8 [opt]
    frame #6: 0x000000010a1af628 QtWidgets`QWidgetPrivate::setVisible(this=0x000000010add01e0, visible=<unavailable>) at qwidget.cpp:8218:16 [opt]
    frame #7: 0x000000010a2f997c QtWidgets`QMenuPrivate::popup(this=0x000000010add01e0, p=<unavailable>, atAction=0x0000000000000000, positionFunction=<unavailable>)>) at qmenu.cpp:0 [opt]
    frame #8: 0x000000010a2f8e00 QtWidgets`QMenu::popup(this=<unavailable>, p=<unavailable>, atAction=<unavailable>) at qmenu.cpp:2307:8 [opt]
    frame #9: 0x000000010a302b40 QtWidgets`QMenuBarPrivate::popupAction(this=0x000000010adcf920, action=0x00006000000333f0, activateFirst=false) at qmenubar.cpp:357:21 [opt]
    frame #10: 0x000000010a302410 QtWidgets`QMenuBarPrivate::setCurrentAction(this=0x000000010adcf920, action=0x00006000000333f0, popup=true, activateFirst=false) at qmenubar.cpp:394:13 [opt]
    frame #11: 0x000000010a1afb38 QtWidgets`QWidget::event(this=0x000000010adc15a0, event=0x000000016fdfac70) at qwidget.cpp:0:5 [opt]
    frame #12: 0x000000010a165330 QtWidgets`QApplicationPrivate::notify_helper(this=<unavailable>, receiver=0x000000010adc15a0, e=0x000000016fdfac70) at qapplication.cpp:3337:26 [opt]
    frame #13: 0x000000010a167548 QtWidgets`QApplication::notify(this=<unavailable>, receiver=0x000000010adc15a0, e=0x000000016fdfac70) at qapplication.cpp:2826:30 [opt]
    frame #14: 0x00000001005f0314 OpenStudioApp`openstudio::OSAppBase::notify(this=0x000000016fdfdb68, receiver=0x000000010adc15a0, e=0x000000016fdfac70) at OSAppBase.cpp:78:24
    frame #15: 0x000000010001c5a0 OpenStudioApp`openstudio::OpenStudioApp::notify(this=0x000000016fdfdb68, receiver=0x000000010adc15a0, event=0x000000016fdfac70) at OpenStudioApp.cpp:1067:21
    frame #16: 0x000000010b21086c QtCore`QCoreApplication::notifyInternal2(receiver=0x000000010adc15a0, event=0x000000016fdfac70) at qcoreapplication.cpp:1068:18 [opt]
    frame #17: 0x000000010a2f67d4 QtWidgets`QMenuPrivate::mouseEventTaken(this=<unavailable>, e=0x000000016fdfb3b0) at qmenu.cpp:1404:17 [opt]
    frame #18: 0x000000010a2fcac4 QtWidgets`QMenu::mouseMoveEvent(this=0x0000600000d7e8e0, e=0x000000016fdfb3b0) at qmenu.cpp:3421:46 [opt]
    frame #19: 0x000000010a1afb38 QtWidgets`QWidget::event(this=0x0000600000d7e8e0, event=0x000000016fdfb3b0) at qwidget.cpp:0:5 [opt]
    frame #20: 0x000000010a2fb7bc QtWidgets`QMenu::event(this=0x0000600000d7e8e0, e=0x000000016fdfb3b0) at qmenu.cpp:3038:21 [opt]
    frame #21: 0x000000010a165330 QtWidgets`QApplicationPrivate::notify_helper(this=<unavailable>, receiver=0x0000600000d7e8e0, e=0x000000016fdfb3b0) at qapplication.cpp:3337:26 [opt]
    frame #22: 0x000000010a167548 QtWidgets`QApplication::notify(this=<unavailable>, receiver=0x0000600000d7e8e0, e=0x000000016fdfb3b0) at qapplication.cpp:2826:30 [opt]
    frame #23: 0x00000001005f0314 OpenStudioApp`openstudio::OSAppBase::notify(this=0x000000016fdfdb68, receiver=0x0000600000d7e8e0, e=0x000000016fdfb3b0) at OSAppBase.cpp:78:24
    frame #24: 0x000000010001c5a0 OpenStudioApp`openstudio::OpenStudioApp::notify(this=0x000000016fdfdb68, receiver=0x0000600000d7e8e0, event=0x000000016fdfb3b0) at OpenStudioApp.cpp:1067:21
    frame #25: 0x000000010b21086c QtCore`QCoreApplication::notifyInternal2(receiver=0x0000600000d7e8e0, event=0x000000016fdfb3b0) at qcoreapplication.cpp:1068:18 [opt]
    frame #26: 0x000000010a165a68 QtWidgets`QApplicationPrivate::sendMouseEvent(receiver=0x0000600000d7e8e0, event=0x000000016fdfb3b0, alienWidget=<unavailable>, nativeWidget=0x0000600000d7e8e0, buttonDown=<unavailable>, lastMouseReceiver=filled=0, spontaneous=<unavailable>, onlyDispatchEnterLeave=false) at qapplication.cpp:2410:22 [opt]
    frame #27: 0x000000010a1c3db0 QtWidgets`QWidgetWindow::handleMouseEvent(this=0x00006000026499e0, event=0x000000016fdfb870) at qwidgetwindow.cpp:563:17 [opt]
    frame #28: 0x000000010a1c2bc4 QtWidgets`QWidgetWindow::event(this=0x00006000026499e0, event=0x000000016fdfb870) at qwidgetwindow.cpp:285:9 [opt]
    frame #29: 0x000000010a165330 QtWidgets`QApplicationPrivate::notify_helper(this=<unavailable>, receiver=<unavailable>, e=<unavailable>) at qapplication.cpp:3337:26 [opt]
    frame #30: 0x000000010a166398 QtWidgets`QApplication::notify(this=0x000000016fdfdb68, receiver=0x00006000026499e0, e=0x000000016fdfb870) at qapplication.cpp:3288:18 [opt]
    frame #31: 0x00000001005f0314 OpenStudioApp`openstudio::OSAppBase::notify(this=0x000000016fdfdb68, receiver=0x00006000026499e0, e=0x000000016fdfb870) at OSAppBase.cpp:78:24
    frame #32: 0x000000010001c5a0 OpenStudioApp`openstudio::OpenStudioApp::notify(this=0x000000016fdfdb68, receiver=0x00006000026499e0, event=0x000000016fdfb870) at OpenStudioApp.cpp:1067:21
    frame #33: 0x000000010b21086c QtCore`QCoreApplication::notifyInternal2(receiver=0x00006000026499e0, event=0x000000016fdfb870) at qcoreapplication.cpp:1068:18 [opt]
    frame #34: 0x00000001096293a8 QtGui`QGuiApplicationPrivate::processMouseEvent(e=0x000000016fdfbb38) at qguiapplication.cpp:2255:5 [opt]
    frame #35: 0x00000001096291a8 QtGui`QGuiApplicationPrivate::processMouseEvent(e=0x0000600002cc1100) at qguiapplication.cpp:2164:9 [opt]
    frame #36: 0x000000010966fe94 QtGui`QWindowSystemInterface::sendWindowSystemEvents(flags=(i = 0)) at qwindowsysteminterface.cpp:1135:13 [opt]
    frame #37: 0x000000010b018534 libqcocoa.dylib`QCocoaEventDispatcherPrivate::postedEventsSourceCallback(info=0x000000010a85f980) at qcocoaeventdispatcher.mm:925:8 [opt]
    frame #38: 0x000000018626e9a0 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
    frame #39: 0x000000018626e8ec CoreFoundation`__CFRunLoopDoSource0 + 208
    frame #40: 0x000000018626e5ec CoreFoundation`__CFRunLoopDoSources0 + 268
    frame #41: 0x000000018626cf6c CoreFoundation`__CFRunLoopRun + 828
    frame #42: 0x000000018626c490 CoreFoundation`CFRunLoopRunSpecific + 600
    frame #43: 0x000000018ee8cdd8 HIToolbox`RunCurrentEventLoopInMode + 292
    frame #44: 0x000000018ee8ca64 HIToolbox`ReceiveNextEventCommon + 324
    frame #45: 0x000000018ee8c908 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 72
    frame #46: 0x0000000188dcbbcc AppKit`_DPSNextEvent + 860
    frame #47: 0x0000000188dca4c4 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1328
    frame #48: 0x0000000188dbc690 AppKit`-[NSApplication run] + 596
    frame #49: 0x000000010b01741c libqcocoa.dylib`QCocoaEventDispatcher::processEvents(this=0x00006000000077c0, flags=<unavailable>) at qcocoaeventdispatcher.mm:430:17 [opt]
    frame #50: 0x000000010b219f28 QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) [inlined] QEventLoop::processEvents(this=0x000000016fdfd560, flags=<unavailable>) at qeventloop.cpp:136:55 [opt]
    frame #51: 0x000000010b219f04 QtCore`QEventLoop::exec(this=0x000000016fdfd560, flags=<unavailable>) at qeventloop.cpp:218:9 [opt]
    frame #52: 0x000000010b210f48 QtCore`QCoreApplication::exec() at qcoreapplication.cpp:1389:32 [opt]
    frame #53: 0x000000010000a6cc OpenStudioApp`main(argc=1, argv=0x000000016fdfe3c0) at main.cpp:240:20
    frame #54: 0x0000000108d25088 dyld`start + 516

jmarrec avatar Jun 03 '22 10:06 jmarrec

Arg, the functions are inline so I 'm not sure what's happening. Here's me saving a model explicitly:

[openstudio.OSDocument] <-2> Saving /Users/julien/Downloads/temp/plop.osm complete
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100608f08 OpenStudioApp`openstudio::OSDocument::markAsUnmodified(this=0x00000001750a5d18) at OSDocument.cpp:763:3
   760 	}
   761
   762 	void OSDocument::markAsUnmodified() {
-> 763 	  m_mainWindow->setWindowModified(false);
   764
   765 	  m_mainWindow->enableRevertToSavedAction(false);
   766 	}
Target 0: (OpenStudioApp) stopped.
(lldb) n
2022-06-03 12:17:28.393455+0200 OpenStudioApp[20272:1312894] [default] enable_updates_common timed out waiting for updates to reenable
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
    frame #0: 0x000000010a1b2dec QtWidgets`QWidget::setWindowModified(bool) [inlined] QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::get(this=0x0000600003033698) const at qscopedpointer.h:147:16 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb) n
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010a1b2df0 QtWidgets`QWidget::setWindowModified(this=0x0000600003033690, mod=false) at qwidget.cpp:11389:5 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb) n
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010a1b2e18 QtWidgets`QWidget::setWindowModified(this=0x0000600003033690, mod=false) at qwidget.cpp:11391:8 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 3.4
    frame #0: 0x000000010b0496fc libqcocoa.dylib`non-virtual thunk to QCocoaWindow::setWindowModified(bool) [inlined] QCocoaWindow::isContentView(this=<unavailable>) const at qcocoawindow.mm:1470:12 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010b049724 libqcocoa.dylib`non-virtual thunk to QCocoaWindow::setWindowModified(bool) [inlined] QCocoaWindow::setWindowModified(this=<unavailable>, modified=<unavailable>) at qcocoawindow.mm:1741:9 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010b04972c libqcocoa.dylib`non-virtual thunk to QCocoaWindow::setWindowModified(bool) [inlined] QCocoaWindow::setWindowModified(this=<unavailable>, modified=<unavailable>) at qcocoawindow.mm:1744:12 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010b049748 libqcocoa.dylib`non-virtual thunk to QCocoaWindow::setWindowModified(bool) [inlined] QCocoaWindow::setWindowModified(this=<unavailable>, modified=<unavailable>) at qcocoawindow.mm:1741:10 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010a19fad8 QtWidgets`QWidgetPrivate::setWindowModified_helper(this=0x00000001750a0510) at qwidget.cpp:11407:9 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010a19fc24 QtWidgets`QWidgetPrivate::setWindowModified_helper(this=<unavailable>) at qwidget.cpp:11413:1 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010a1b2e1c QtWidgets`QWidget::setWindowModified(this=0x0000600003033690, mod=<unavailable>) at qwidget.cpp:11393:12 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010a1b2e28 QtWidgets`QWidget::setWindowModified(this=0x0000600003033690, mod=<unavailable>) at qwidget.cpp:11394:5 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010a1b2e34 QtWidgets`QWidget::setWindowModified(this=0x0000600003033690, mod=<unavailable>) at qwidget.cpp:11395:1 [opt]
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100608f1c OpenStudioApp`openstudio::OSDocument::markAsUnmodified(this=0x00000001750a5d18) at OSDocument.cpp:763:17
   760 	}
   761
   762 	void OSDocument::markAsUnmodified() {
-> 763 	  m_mainWindow->setWindowModified(false);
   764
   765 	  m_mainWindow->enableRevertToSavedAction(false);
   766 	}
Target 0: (OpenStudioApp) stopped.
(lldb)
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100608f24 OpenStudioApp`openstudio::OSDocument::markAsUnmodified(this=0x00000001750a5d18) at OSDocument.cpp:765:3
   762 	void OSDocument::markAsUnmodified() {
   763 	  m_mainWindow->setWindowModified(false);
   764
-> 765 	  m_mainWindow->enableRevertToSavedAction(false);
   766 	}
   767
   768 	void OSDocument::disableTabsDuringRun() {
Target 0: (OpenStudioApp) stopped.
(lldb) n
Process 20272 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100608f30 OpenStudioApp`openstudio::OSDocument::markAsUnmodified(this=0x00000001750a5d18) at OSDocument.cpp:766:1
   763 	  m_mainWindow->setWindowModified(false);
   764
   765 	  m_mainWindow->enableRevertToSavedAction(false);
-> 766 	}

jmarrec avatar Jun 03 '22 10:06 jmarrec