Client: owncloud on macOS crashes if I open the Settings window the second time

Created on 18 Dec 2018  路  8Comments  路  Source: owncloud/client

Expected behaviour

The Settings window can be opened many times

Actual behaviour

owncloud on macOS crashes with the following backtrace:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x7d1636e7480)
  * frame #0: 0x00007fff5caa8a1d libobjc.A.dylib`objc_msgSend + 29
    frame #1: 0x00000001000e9c11 owncloud`MacPreferencesWindowPrivate::displayPanel(int) + 125
    frame #2: 0x00000001000ea184 owncloud`MacPreferencesWindow::event(QEvent*) + 34
    frame #3: 0x0000000100673039 QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 269
    frame #4: 0x00000001006743b1 QtWidgets`QApplication::notify(QObject*, QEvent*) + 723
    frame #5: 0x000000010266ec94 QtCore`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 154
    frame #6: 0x00000001006a16bf QtWidgets`QWidgetPrivate::show_helper() + 369
    frame #7: 0x00000001006a20e6 QtWidgets`QWidget::setVisible(bool) + 844
    frame #8: 0x00000001000ea24f owncloud`MacPreferencesWindow::setVisible(bool) + 187
    frame #9: 0x0000000100067ffe owncloud`OCC::ownCloudGui::raiseDialog(QWidget*) + 40
    frame #10: 0x0000000102694b89 QtCore`QMetaObject::activate(QObject*, int, int, void**) + 1907
    frame #11: 0x000000010066b7b5 QtWidgets`QAction::activate(QAction::ActionEvent) + 307
    frame #12: 0x000000010268ed1c QtCore`QObject::event(QEvent*) + 124
    frame #13: 0x0000000100673039 QtWidgets`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 269
    frame #14: 0x00000001006743b1 QtWidgets`QApplication::notify(QObject*, QEvent*) + 723
    frame #15: 0x000000010266ec94 QtCore`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 154
    frame #16: 0x000000010266f925 QtCore`QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 435
    frame #17: 0x000000010a20ba2f libqcocoa.dylib`___lldb_unnamed_symbol660$$libqcocoa.dylib + 183
    frame #18: 0x000000010a20c18f libqcocoa.dylib`___lldb_unnamed_symbol672$$libqcocoa.dylib + 33
    frame #19: 0x00007fff30961475 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #20: 0x00007fff3096141b CoreFoundation`__CFRunLoopDoSource0 + 108
    frame #21: 0x00007fff30944eb5 CoreFoundation`__CFRunLoopDoSources0 + 195
    frame #22: 0x00007fff3094445e CoreFoundation`__CFRunLoopRun + 1219
    frame #23: 0x00007fff30943d48 CoreFoundation`CFRunLoopRunSpecific + 463
    frame #24: 0x00007fff2fbdaab5 HIToolbox`RunCurrentEventLoopInMode + 293
    frame #25: 0x00007fff2fbda6f4 HIToolbox`ReceiveNextEventCommon + 371
    frame #26: 0x00007fff2fbda568 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
    frame #27: 0x00007fff2de95363 AppKit`_DPSNextEvent + 997
    frame #28: 0x00007fff2de94102 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
    frame #29: 0x000000010a20ad7d libqcocoa.dylib`___lldb_unnamed_symbol652$$libqcocoa.dylib + 1123
    frame #30: 0x000000010266b7ac QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 318
    frame #31: 0x000000010266f148 QtCore`QCoreApplication::exec() + 116
    frame #32: 0x0000000100007543 owncloud`main + 1194
    frame #33: 0x00007fff5db85ed9 libdyld.dylib`start + 1

Steps to reproduce

  1. Install a fresh copy of owncloud-client
  2. Run it
  3. Close the Connection Wizard using the red X button of macOS
  4. Click on the tray icon and choose Settings
  5. Closes the Settings window
  6. Repeat step 4

Server configuration

N/A

Client configuration

Client version: 2.5.1

Operating system: macOS Mojave 10.14.2

OS language: zh_TW

Qt version used by client package (Linux only, see also Settings dialog): Qt 5.12.0 from MacPorts

Client package (From ownCloud or distro) (Linux only): built from source

Installation path of client: /Applications/MacPorts/owncloud.app/Contents/MacOS/owncloud

Logs

  1. Client logfile: Output of owncloud --logwindow or owncloud --logfile log.txt
12-18 19:36:47:663 [ info gui.application ]:    "################## ownCloud locale:[zh_TW] ui_lang:[] version:[2.5.1 (build 10818)] os:[macOS 10.14]"
12-18 19:36:47:663 [ info gui.application ]:    Using "en_TW" translation
12-18 19:36:47:668 [ info gui.socketapi ]:  server started, listening at  "com.owncloud.desktopclient.socketApi"
12-18 19:36:47:668 [ info gui.folder.manager ]: setting remote poll timer interval to 30000 msec
12-18 19:36:47:917 [ info gui.application ]:    Tray menu workarounds: noabouttoshow: true fakedoubleclick: false showhide: false manualvisibility: true
12-18 19:36:47:938 [ info gui.folder.manager ]: Setup folders from  "/Users/yen/Library/Preferences/ownCloud/folders" (migration)
12-18 19:36:47:939 [ info sync.clientproxy ]:   Set proxy configuration to use system configuration
12-18 19:36:47:999 [ info gui.application ]:    No configured folders yet, starting setup wizard
12-18 19:36:50:801 [ info gui.updater ]:    Checking for available update
12-18 19:36:50:801 [ info sync.accessmanager ]: 2 "" "https://updates.owncloud.com/client/?version=2.5.1.10818&platform=macos&oem=ownCloud&versionsuffix=" has X-Request-ID "14d56fb0-00c4-49c3-90d4-403c448c27bf"
12-18 19:36:52:081 [ info gui.updater ]:    Client is on latest version!
  1. Web server error log: N/A

  2. Server logfile: ownCloud log (data/owncloud.log): N/A

PR available bug macOS

All 8 comments

@yan12125 Thank you for the backtrace, very much appreciated!

@guruz Looking at the backtrace I'd guess that

    NSView *view = reinterpret_cast<NSView *>(q->effectiveWinId());
    NSRect frame = view.window.frame;

causes the crash. Maybe the NSView retrieved in this way is invalid?

Checking QMacNativeWidget, it does the following to get the NSView:

winId();
windowHandle()->create();
QPlatformNativeInterface *platformNativeInterface = QGuiApplication::platformNativeInterface();
NSView *qtView = (NSView *)platformNativeInterface->nativeResourceForWindow("nsview", windowHandle());

I imagine it'd be worthwhile to do that instead and let someone who can reproduce try.

@yan12125 Do you compile from source on osx?

Do you compile from source on osx?

Yes, and I use Qt from MacPorts. I'm willing to test patches, too.

@yan12125 It's a shot in the dark since I don't have OSX, but try this patch applied to src/3rdparty/qtmacgoodies:
patch.txt

With some minor fixes to make it build, the client no longer crashes with the original steps-to-reproduce!

My modified version: patch_ver2.txt. Additions to a CMake file in the main repo is also necessary:

diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 9eaf326f8..a34f33fa6 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -164,6 +164,7 @@ if (APPLE)
         ../3rdparty/qtmacgoodies/src/macstandardicon.mm
         ../3rdparty/qtmacgoodies/src/macwindow.mm
         )
+    include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
 endif()

 if(NOT WIN32)

By the way, when no patches are applied, I noticed that hitting ESC to close the client does not ends up in a crash, while clicking the X button does.

@yan12125 Thanks for testing and making the patch work!
@guruz I don't think we currently rely on private headers, would that be acceptable on OSX?

Thank you all for fixing this issue! I confirm the latest 2.5 branch runs fine.

tested on macos 10.14

crash not reproducable. -> GOOD

Was this page helpful?
0 / 5 - 0 ratings