Daniel Reetz, the founder of the DIY Book Scanner community, has recently started making videos of prototyping and shop tips. If you are tinkering with a book scanner (or any other project) in your home shop, these tips will come in handy. https://www.youtube.com/channel/UCn0gq8 ... g_8K1nfInQ

Mac problem - contextual menus cause crash

Scan Tailor specific announcements, releases, workflows, tips, etc. NO FEATURE REQUESTS IN THIS FORUM, please.
User avatar
n9yty
Posts: 72
Joined: 25 Jul 2010, 22:13

Mac problem - contextual menus cause crash

Post by n9yty » 26 Oct 2010, 12:11

This has been there on all the builds I've done, and I am not quite sure where to look to debug this, so I'm hoping putting it out here might get me a few pointers.

It may be related just to zones, like picture and fill zones. The menu in the right pages sidebar to insert before/after seems to work fine.

Right-clicking (or control-clicking) brings up the menu, but as soon as you select an item and the menu goes away the program freezes for a bit then crashes.

I guess I can start digging in the zones stuff and menu handling in there, comparing with how things are handled in the page sidebar and see if there is some missing Mutex or other locking missing that causes the crash (just a wild guess).

Puzzling on exactly where the problem is because it's in the Qt event stuff, the crashing thread isn't even referencing relevant scantailor code. :(

Here are two crash dumps, and a gdb backtrace, but they all show the same unhelpful information, at least to me... :( Looks like it is falling apart when invoking the bound action for the selected menu item. But why this happens on only osx and only for the zone menus and not the others, I have yet to uncover.

Code: Select all

Process:         ScanTailor [3142]
Path:            /Applications/ScanTailor.app/Contents/MacOS/ScanTailor
Identifier:      net.sourceforge.Scantailor
Version:         ScanTailor-0.9.9.2 (???)
Code Type:       X86 (Native)
Parent Process:  launchd [468]

Date/Time:       2010-10-26 10:53:55.864 -0500
OS Version:      Mac OS X 10.6.5 (10H563)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000000c
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   QtGui                         	0x003e5b08 non-virtual thunk to QWidget::devType() const + 936
1   QtGui                         	0x0082725a QMenu::sizeHint() const + 634
2   QtGui                         	0x00828b63 QMenu::event(QEvent*) + 979
3   QtGui                         	0x0082a688 QMenu::wheelEvent(QWheelEvent*) + 1464
4   QtGui                         	0x0082aa09 QMenu::wheelEvent(QWheelEvent*) + 2361
5   QtGui                         	0x0082d22e QMenu::mouseReleaseEvent(QMouseEvent*) + 254
6   QtGui                         	0x003dfbd3 QWidget::event(QEvent*) + 4323
7   QtGui                         	0x008287ef QMenu::event(QEvent*) + 95
8   QtGui                         	0x003869ff QApplicationPrivate::notify_helper(QObject*, QEvent*) + 175
9   QtGui                         	0x003874f9 QApplication::notify(QObject*, QEvent*) + 2681
10  QtCore                        	0x00f054f2 QCoreApplication::notifyInternal(QObject*, QEvent*) + 98
11  QtGui                         	0x00318358 QApplicationPrivate::globalEventProcessor(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 7944
12  com.apple.HIToolbox           	0x90d32eef DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
13  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
14  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
15  com.apple.HIToolbox           	0x90d66497 ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 1257
16  com.apple.HIToolbox           	0x90d33340 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2672
17  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
18  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
19  QtGui                         	0x0032fca4 non-virtual thunk to QDesktopWidget::~QDesktopWidget() + 7668
20  QtCore                        	0x00fe6041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
21  QtCore                        	0x00fe627d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
22  QtCore                        	0x00fe857e QCoreApplication::exec() + 174
23  net.sourceforge.Scantailor    	0x000052ad main + 1165
24  net.sourceforge.Scantailor    	0x00004be6 _start + 216
25  net.sourceforge.Scantailor    	0x00004b0d start + 41

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib             	0x9748c982 kevent + 10
1   libSystem.B.dylib             	0x9748d09c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib             	0x9748c559 _dispatch_queue_invoke + 163
3   libSystem.B.dylib             	0x9748c2fe _dispatch_worker_thread2 + 240
4   libSystem.B.dylib             	0x9748bd81 _pthread_wqthread + 390
5   libSystem.B.dylib             	0x9748bbc6 start_wqthread + 30

Thread 2:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01009958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x0100d119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x0100e89c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x00fe6041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00fe627d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x00f27dbd QThread::exec() + 157
8   net.sourceforge.Scantailor    	0x00069402 WorkerThread::Impl::run() + 34
9   QtCore                        	0x00f28776 QThread::setTerminationEnabled(bool) + 278
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 3:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01009958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x0100d119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x0100e89c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x00fe6041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00fe627d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x00f27dbd QThread::exec() + 157
8   QtCore                        	0x00f28776 QThread::setTerminationEnabled(bool) + 278
9   libSystem.B.dylib             	0x9749385d _pthread_start + 345
10  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 4:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01009958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x0100d119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x0100e89c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x00fe6041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00fe627d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x00f27dbd QThread::exec() + 157
8   QtCore                        	0x00f28776 QThread::setTerminationEnabled(bool) + 278
9   libSystem.B.dylib             	0x9749385d _pthread_start + 345
10  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x01350598  ebx: 0x00828b35  ecx: 0x000b6740  edx: 0x00000000
  edi: 0xbfffe640  esi: 0x00000000  ebp: 0xbfffe5e8  esp: 0xbfffe5cc
   ss: 0x0000001f  efl: 0x00010246  eip: 0x003e5b08   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x0000000c

Code: Select all

Process:         ScanTailor [3174]
Path:            /Applications/ScanTailor.app/Contents/MacOS/ScanTailor
Identifier:      net.sourceforge.Scantailor
Version:         ScanTailor-0.9.9.2 (???)
Code Type:       X86 (Native)
Parent Process:  launchd [468]

Date/Time:       2010-10-26 10:55:53.526 -0500
OS Version:      Mac OS X 10.6.5 (10H563)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000636f6f77
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   QtCore                        	0x00f07f26 QMetaObject::cast(QObject*) const + 22
1   QtGui                         	0x0082a9f0 QMenu::wheelEvent(QWheelEvent*) + 2336
2   QtGui                         	0x0082d22e QMenu::mouseReleaseEvent(QMouseEvent*) + 254
3   QtGui                         	0x003dfbd3 QWidget::event(QEvent*) + 4323
4   QtGui                         	0x008287ef QMenu::event(QEvent*) + 95
5   QtGui                         	0x003869ff QApplicationPrivate::notify_helper(QObject*, QEvent*) + 175
6   QtGui                         	0x003874f9 QApplication::notify(QObject*, QEvent*) + 2681
7   QtCore                        	0x00f054f2 QCoreApplication::notifyInternal(QObject*, QEvent*) + 98
8   QtGui                         	0x00318358 QApplicationPrivate::globalEventProcessor(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 7944
9   com.apple.HIToolbox           	0x90d32eef DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
10  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
11  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
12  com.apple.HIToolbox           	0x90d66497 ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 1257
13  com.apple.HIToolbox           	0x90d33340 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2672
14  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
15  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
16  QtGui                         	0x0032fca4 non-virtual thunk to QDesktopWidget::~QDesktopWidget() + 7668
17  QtCore                        	0x00fe6041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
18  QtCore                        	0x00fe627d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
19  QtCore                        	0x00fe857e QCoreApplication::exec() + 174
20  net.sourceforge.Scantailor    	0x000052ad main + 1165
21  net.sourceforge.Scantailor    	0x00004be6 _start + 216
22  net.sourceforge.Scantailor    	0x00004b0d start + 41

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib             	0x9748c982 kevent + 10
1   libSystem.B.dylib             	0x9748d09c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib             	0x9748c559 _dispatch_queue_invoke + 163
3   libSystem.B.dylib             	0x9748c2fe _dispatch_worker_thread2 + 240
4   libSystem.B.dylib             	0x9748bd81 _pthread_wqthread + 390
5   libSystem.B.dylib             	0x9748bbc6 start_wqthread + 30

Thread 2:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01009958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x0100d119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x0100e89c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x00fe6041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00fe627d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x00f27dbd QThread::exec() + 157
8   net.sourceforge.Scantailor    	0x00069402 WorkerThread::Impl::run() + 34
9   QtCore                        	0x00f28776 QThread::setTerminationEnabled(bool) + 278
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 3:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01009958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x0100d119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x0100e89c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x00fe6041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00fe627d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x00f27dbd QThread::exec() + 157
8   QtCore                        	0x00f28776 QThread::setTerminationEnabled(bool) + 278
9   libSystem.B.dylib             	0x9749385d _pthread_start + 345
10  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 4:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01009958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x0100d119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x0100e89c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x00fe6041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00fe627d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x00f27dbd QThread::exec() + 157
8   QtCore                        	0x00f28776 QThread::setTerminationEnabled(bool) + 278
9   libSystem.B.dylib             	0x9749385d _pthread_start + 345
10  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x636f6f77  ebx: 0x0082a78b  ecx: 0x00c3976c  edx: 0x00000000
  edi: 0x00c3976c  esi: 0x636f6f77  ebp: 0xbfffe6f8  esp: 0xbfffe6e0
   ss: 0x0000001f  efl: 0x00010206  eip: 0x00f07f26   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x636f6f77

Code: Select all

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x65cfe55a
0x015700e8 in vtable for QDomNodePrivate ()
(gdb) bt
#0  0x015700e8 in vtable for QDomNodePrivate ()
#1  0x01cb0000 in ?? ()
#2  0x00e2e9f0 in QMenuPrivate::activateAction ()
#3  0x00e3122e in QMenu::mouseReleaseEvent ()
#4  0x009e3bd3 in QWidget::event ()
#5  0x00e2c7ef in QMenu::event ()
#6  0x0098a9ff in QApplicationPrivate::notify_helper ()
#7  0x0098b4f9 in QApplication::notify ()
#8  0x015dc4f2 in QCoreApplication::notifyInternal ()
#9  0x0091c358 in QApplicationPrivate::globalEventProcessor ()
#10 0x90d32eef in DispatchEventToHandlers ()
#11 0x90d321b6 in SendEventToEventTargetInternal ()
#12 0x90d5497b in SendEventToEventTarget ()
#13 0x90d66497 in ToolboxEventDispatcherHandler ()
#14 0x90d33340 in DispatchEventToHandlers ()
#15 0x90d321b6 in SendEventToEventTargetInternal ()
#16 0x90d5497b in SendEventToEventTarget ()
#17 0x00933ca4 in QEventDispatcherMac::processEvents ()
#18 0x016bd041 in QEventLoop::processEvents ()
#19 0x016bd27d in QEventLoop::exec ()
#20 0x016bf57e in QCoreApplication::exec ()
#21 0x000075e1 in main (argc=1, argv=0xbffff838) at /usr/local/src/scantailor/scantailor-9224b0d/main.cpp:184

Tulon
Posts: 687
Joined: 03 Oct 2009, 06:13
Number of books owned: 0
Location: London, UK
Contact:

Re: Mac problem - contextual menus cause crash

Post by Tulon » 26 Oct 2010, 17:13

Looks like Scan Tailor is triggering a bug in the Mac version of Qt. Even though I do have an old PPC Mac running Tiger around, I am not willing to spend a whole week-end or two setting up the development environment and looking for a workaround.

To tell you the truth, I haven't written a single line of code for Scan Tailor in the past few weeks. I just don't feel like it.

There is one thing you could try though: Qt for Mac comes in two flavours: QtCarbon and QtCocoa. The binary builds from Nokia are QtCarbon I believe. So, you download Qt's source code and make a QtCocoa build. You'll loose compatibility with Tiger, but maybe this bug will disappear.
Scan Tailor experimental doesn't output 96 DPI images. It's just what your software shows when DPI information is missing. Usually what you get is input DPI times the resolution enhancement factor.

User avatar
n9yty
Posts: 72
Joined: 25 Jul 2010, 22:13

Re: Mac problem - contextual menus cause crash

Post by n9yty » 26 Oct 2010, 20:26

Tulon wrote:To tell you the truth, I haven't written a single line of code for Scan Tailor in the past few weeks. I just don't feel like it.
No problem, Tulon, I will keep looking at it from time to time, who knows, I may uncover the bug. I would be glad to help that way if I can. If I can't, and it lasts long enough, you may be enthused enough to look at it then. :) Thanks for all your great work, take a well deserved break and focus on other things in life that give you enjoyment.

Nokia has Cocoa binary builds, i386/x86_64 only, so I used them. I rebuilt everything using gcc-4.2.1 (instead of gcc-4.0 as used for 10.4 compatibility), and yet it has made no difference... Interesting problem. :) Report attached below.

Code: Select all

Process:         ScanTailor [34298]
Path:            /usr/local/src/scantailor/scantailor-build/ScanTailor.app/Contents/MacOS/ScanTailor
Identifier:      net.sourceforge.Scantailor
Version:         ScanTailor-0.9.9.2 (???)
Code Type:       X86 (Native)
Parent Process:  launchd [468]

Date/Time:       2010-10-26 20:01:10.133 -0500
OS Version:      Mac OS X 10.6.5 (10H563)
Report Version:  6

Interval Since Last Report:          16666 sec
Crashes Since Last Report:           1
Per-App Interval Since Last Report:  57 sec
Per-App Crashes Since Last Report:   1
Anonymous UUID:                      40BECA1D-6F3A-449D-840F-C981A03160F3

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000017c
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   QtGui                         	0x007c94e3 QMenu::event(QEvent*) + 1619
1   QtGui                         	0x007cb53e QMenu::mouseReleaseEvent(QMouseEvent*) + 254
2   QtGui                         	0x003f3945 QWidget::event(QEvent*) + 2565
3   QtGui                         	0x007c8eef QMenu::event(QEvent*) + 95
4   QtGui                         	0x0039525c QApplicationPrivate::notify_helper(QObject*, QEvent*) + 188
5   QtGui                         	0x0039dc0d QApplication::notify(QObject*, QEvent*) + 7901
6   QtCore                        	0x00e75aec QCoreApplication::notifyInternal(QObject*, QEvent*) + 108
7   QtGui                         	0x0039559c QApplication::topLevelWidgets() + 492
8   QtGui                         	0x003496c3 QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool() + 19379
9   QtGui                         	0x003378a6 QWidget::setWindowState(QFlags<Qt::WindowState>) + 8022
10  com.apple.AppKit              	0x947ea817 -[NSApplication sendEvent:] + 6431
11  QtGui                         	0x00343add QMacInputContext::reset() + 46285
12  com.apple.AppKit              	0x9477e2a7 -[NSApplication run] + 917
13  QtGui                         	0x0034dad1 QDesktopWidget::resizeEvent(QResizeEvent*) + 12497
14  QtCore                        	0x00f52961 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
15  QtCore                        	0x00f52caa QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 170
16  QtCore                        	0x00f54326 QCoreApplication::exec() + 182
17  net.sourceforge.Scantailor    	0x000054cd main + 1165
18  net.sourceforge.Scantailor    	0x0000500a start + 54

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib             	0x9748c982 kevent + 10
1   libSystem.B.dylib             	0x9748d09c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib             	0x9748c559 _dispatch_queue_invoke + 163
3   libSystem.B.dylib             	0x9748c2fe _dispatch_worker_thread2 + 240
4   libSystem.B.dylib             	0x9748bd81 _pthread_wqthread + 390
5   libSystem.B.dylib             	0x9748bbc6 start_wqthread + 30

Thread 2:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x00f75770 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 320
3   QtCore                        	0x00f79913 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 435
4   QtCore                        	0x00f79e4f QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 175
5   QtCore                        	0x00f52961 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00f52caa QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 170
7   QtCore                        	0x00e96e5d QThread::exec() + 157
8   net.sourceforge.Scantailor    	0x00069622 WorkerThread::Impl::run() + 34
9   QtCore                        	0x00e97de6 QThread::setPriority(QThread::Priority) + 502
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 3:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x00f75770 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 320
3   QtCore                        	0x00f79913 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 435
4   QtCore                        	0x00f79e4f QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 175
5   QtCore                        	0x00f52961 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00f52caa QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 170
7   QtCore                        	0x00e96e5d QThread::exec() + 157
8   QtCore                        	0x00e97de6 QThread::setPriority(QThread::Priority) + 502
9   libSystem.B.dylib             	0x9749385d _pthread_start + 345
10  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 4:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x00f75770 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 320
3   QtCore                        	0x00f79913 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 435
4   QtCore                        	0x00f79e4f QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 175
5   QtCore                        	0x00f52961 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x00f52caa QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 170
7   QtCore                        	0x00e96e5d QThread::exec() + 157
8   QtCore                        	0x00e97de6 QThread::setPriority(QThread::Priority) + 502
9   libSystem.B.dylib             	0x9749385d _pthread_start + 345
10  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000000  ebx: 0x007c942e  ecx: 0x00000001  edx: 0x00000000
  edi: 0x0158e330  esi: 0x0158e330  ebp: 0xbfffea58  esp: 0xbfffe9e0
   ss: 0x0000001f  efl: 0x00010286  eip: 0x007c94e3   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x0000017c

User avatar
n9yty
Posts: 72
Joined: 25 Jul 2010, 22:13

Re: Mac problem - contextual menus cause crash

Post by n9yty » 27 Oct 2010, 01:25

Even more odd... Compiling in debug mode and using gdb it will still fail. But, if I set a breakpoint and walk through single-step it works. [UPDATE: It did work one time, honest it did :), but this is not repeatable.] So, a possible timing issue? Something with how it is building the actions for the menu in relation to when the call is firing to actually call it? I don't know enough C++ to get much deeper, much less all the boost::bind stuff and the Qt stuff on top of that. But at least there is some progress here that shows hope that things *can* work, so it's not a fundamental flaw in Qt or ScanTailor, but maybe a timing issue?

It is very confusing to me how all the boost::bind stuff works, not to mention the QtSignalForward stuff, connect(), SLOT(), etc... My head hurts. :) But as they would say in the "X Files", the truth is out there...
Last edited by n9yty on 28 Oct 2010, 09:17, edited 1 time in total.

Tulon
Posts: 687
Joined: 03 Oct 2009, 06:13
Number of books owned: 0
Location: London, UK
Contact:

Re: Mac problem - contextual menus cause crash

Post by Tulon » 27 Oct 2010, 03:13

n9yty wrote:It is very confusing to me how all the boost::bind stuff works, not to mention the QtSignalForward stuff, connect(), SLOT(), etc...
Well, you will probably have to learn boost::bind, boost::function and Qt's signal/slot mechanism to figure out what's going wrong. QtSignalForwarder class comes with Scan Tailor not Qt, and is actually documented.
Scan Tailor experimental doesn't output 96 DPI images. It's just what your software shows when DPI information is missing. Usually what you get is input DPI times the resolution enhancement factor.

User avatar
n9yty
Posts: 72
Joined: 25 Jul 2010, 22:13

Re: Mac problem - contextual menus cause crash

Post by n9yty » 27 Oct 2010, 12:30

Tulon, thank you, I know all the pieces are there, and documentation abounds, but it gets harder year after year to pack new information into my head and thought processes. I am largely just self-documenting here, so don't feel that you have to respond unless you have insight. :)

At any rate, trying to narrow it down, I have found that if I remove this:

Code: Select all

// The queued connection is used to ensure it gets called *after*
// QAction::triggered().
connect(
  m_ptrMenu.get(), SIGNAL(aboutToHide()),
  SLOT(menuAboutToHide()), Qt::QueuedConnection
);
It will function properly with respect to the zone functions, but obviously the clean-up work being done in menuAboutToHide() is not getting done that way so the output and image view in the right is not updated. Right now, though, if I remove that, the functions work, I just have to click on a different page and back again to get the updates to happen. For now, this may be preferable on the Mac build rather than the crash behavior. [UPDATE: and once a menu is opened and dismissed, it will not open again unless you switch tabs]

{rambling thoughts - may not be accurate, but documenting here for future reference}
Qt::QueuedConnection documentation says: The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread.

The comment indicates the intention here is so that the triggered signal is handled first before this slot is called, which makes perfect sense for a clean-up routine, but for some reason on the Mac platform this sequence isn't working quite right, or at least it would seem to be the case because debugging shows the crash happening before the triggered signal slot is called. Or something else is going on deeper than I yet understand. I am not sure which threads which operations are happening in, so I don't know exactly how Qt::QueuedConnection will affect the order of slot invocations.
Last edited by n9yty on 28 Oct 2010, 09:11, edited 1 time in total.

Tulon
Posts: 687
Joined: 03 Oct 2009, 06:13
Number of books owned: 0
Location: London, UK
Contact:

Re: Mac problem - contextual menus cause crash

Post by Tulon » 27 Oct 2010, 13:31

n9yty wrote:The comment indicates the intention here is so that the triggered signal is handled first before this slot is called
Think of a QueuedConnection as a mechanism to delay slot invocation. The slot will be invoked some time later after the signal returns.
n9yty wrote:I am not sure which threads which operations are happening in, so I don't know exactly how Qt::QueuedConnection will affect the order of slot invocations.
Although QueuedConnection can be used across threads, in this case it's not. Both signal emission and slot invocation happen in the GUI thread.
Scan Tailor experimental doesn't output 96 DPI images. It's just what your software shows when DPI information is missing. Usually what you get is input DPI times the resolution enhancement factor.

User avatar
n9yty
Posts: 72
Joined: 25 Jul 2010, 22:13

Re: Mac problem - contextual menus cause crash

Post by n9yty » 27 Oct 2010, 15:02

Okay, so I started all over back to the original build configuration for i386/ppc Tiger-10.4 builds.

Confirmed via gdb that menuAboutToHide() is called before menuItemTriggered().

[UPDATE: The crashes described here with respect to bringing up a menu without selecting items were done after I had been tweaking various things... Going back to an unaltered build environment made these go away. Sorry for the confusion.]

If I pop open a zone menu and dismiss it with ESC, I can do that repeatedly. If I bring it up and click with the left button outsize the zone to dismiss it, it crashes:

Code: Select all

Process:         scantailor [10884]
Path:            /usr/local/src/scantailor/scantailor-9224b0d/./scantailor
Identifier:      scantailor
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [1309]

Date/Time:       2010-10-27 13:53:08.446 -0500
OS Version:      Mac OS X 10.6.5 (10H563)
Report Version:  6

Interval Since Last Report:          47833 sec
Crashes Since Last Report:           11
Per-App Crashes Since Last Report:   9
Anonymous UUID:                      40BECA1D-6F3A-449D-840F-C981A03160F3

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000000000000c
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   QtGui                         	0x00d74b08 QList<QAction*>::indexOf(QAction* const&, int) const + 24
1   QtGui                         	0x011b625a QMenuPrivate::actionRect(QAction*) const + 42
2   QtGui                         	0x011b7b63 QMenuPrivate::setCurrentAction(QAction*, int, QMenuPrivate::SelectionReason, bool) + 67
3   QtGui                         	0x011b9688 QMenuPrivate::hideUpToMenuBar() + 248
4   QtGui                         	0x011bc3a6 QMenu::mousePressEvent(QMouseEvent*) + 358
5   QtGui                         	0x00d6ebef QWidget::event(QEvent*) + 4351
6   QtGui                         	0x011b77ef QMenu::event(QEvent*) + 95
7   QtGui                         	0x00d159ff QApplicationPrivate::notify_helper(QObject*, QEvent*) + 175
8   QtGui                         	0x00d164f9 QApplication::notify(QObject*, QEvent*) + 2681
9   QtCore                        	0x019674f2 QCoreApplication::notifyInternal(QObject*, QEvent*) + 98
10  QtGui                         	0x00ca7358 QApplicationPrivate::globalEventProcessor(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 7944
11  com.apple.HIToolbox           	0x90d32eef DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
12  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
13  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
14  QtGui                         	0x00cb6e64 QWidgetPrivate::qt_window_event(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 340
15  com.apple.HIToolbox           	0x90d32eef DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
16  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
17  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
18  com.apple.HIToolbox           	0x90d66497 ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 1257
19  com.apple.HIToolbox           	0x90d33340 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2672
20  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
21  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
22  QtGui                         	0x00cbeca4 QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 596
23  QtCore                        	0x01a48041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
24  QtCore                        	0x01a4827d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
25  QtCore                        	0x01a4a57e QCoreApplication::exec() + 174
26  scantailor                    	0x0000719b main + 1981 (main.cpp:184)
27  scantailor                    	0x000069b2 start + 54

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib             	0x9748c982 kevent + 10
1   libSystem.B.dylib             	0x9748d09c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib             	0x9748c559 _dispatch_queue_invoke + 163
3   libSystem.B.dylib             	0x9748c2fe _dispatch_worker_thread2 + 240
4   libSystem.B.dylib             	0x9748bd81 _pthread_wqthread + 390
5   libSystem.B.dylib             	0x9748bbc6 start_wqthread + 30

Thread 2:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01a6b958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x01a6f119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x01a7089c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x01a48041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x01a4827d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x01989dbd QThread::exec() + 157
8   scantailor                    	0x0009b744 WorkerThread::Impl::run() + 32 (WorkerThread.cpp:278)
9   QtCore                        	0x0198a776 QThreadPrivate::start(void*) + 198
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 3:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01a6b958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x01a6f119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x01a7089c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x01a48041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x01a4827d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x01989dbd QThread::exec() + 157
8   scantailor                    	0x0004e960 ThumbnailPixmapCache::Impl::run() + 28 (ThumbnailPixmapCache.cpp:549)
9   QtCore                        	0x0198a776 QThreadPrivate::start(void*) + 198
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 4:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01a6b958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x01a6f119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x01a7089c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x01a48041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x01a4827d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x01989dbd QThread::exec() + 157
8   scantailor                    	0x00007e2f BackgroundExecutor::Impl::run() + 17 (BackgroundExecutor.cpp:151)
9   QtCore                        	0x0198a776 QThreadPrivate::start(void*) + 198
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x01de7008  ebx: 0x011b7b35  ecx: 0x0008cf00  edx: 0x00000000
  edi: 0xbfffdfd0  esi: 0x00000000  ebp: 0xbfffdf78  esp: 0xbfffdf5c
   ss: 0x0000001f  efl: 0x00010246  eip: 0x00d74b08   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x0000000c
Clicking the left button inside the zone seems to not cause any problem with dismissing the menu. Clicking the right mosue button inside the zone re-opens the menu at the new location. Clicking the right mouse button outside the zone crashes also.

Code: Select all

Process:         scantailor [10910]
Path:            /usr/local/src/scantailor/scantailor-9224b0d/./scantailor
Identifier:      scantailor
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [1309]

Date/Time:       2010-10-27 13:54:50.604 -0500
OS Version:      Mac OS X 10.6.5 (10H563)
Report Version:  6

Interval Since Last Report:          47935 sec
Crashes Since Last Report:           12
Per-App Crashes Since Last Report:   10
Anonymous UUID:                      40BECA1D-6F3A-449D-840F-C981A03160F3

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000008
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   QtGui                         	0x00ea3bc8 QRegion::isEmpty() const + 24
1   QtGui                         	0x011b7ba8 QMenuPrivate::setCurrentAction(QAction*, int, QMenuPrivate::SelectionReason, bool) + 136
2   QtGui                         	0x011b9688 QMenuPrivate::hideUpToMenuBar() + 248
3   QtGui                         	0x011bc3a6 QMenu::mousePressEvent(QMouseEvent*) + 358
4   QtGui                         	0x00d6ebef QWidget::event(QEvent*) + 4351
5   QtGui                         	0x011b77ef QMenu::event(QEvent*) + 95
6   QtGui                         	0x00d159ff QApplicationPrivate::notify_helper(QObject*, QEvent*) + 175
7   QtGui                         	0x00d164f9 QApplication::notify(QObject*, QEvent*) + 2681
8   QtCore                        	0x019674f2 QCoreApplication::notifyInternal(QObject*, QEvent*) + 98
9   QtGui                         	0x00ca7358 QApplicationPrivate::globalEventProcessor(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 7944
10  com.apple.HIToolbox           	0x90d32eef DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
11  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
12  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
13  QtGui                         	0x00cb6e64 QWidgetPrivate::qt_window_event(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 340
14  com.apple.HIToolbox           	0x90d32eef DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
15  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
16  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
17  com.apple.HIToolbox           	0x90d66497 ToolboxEventDispatcherHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 1257
18  com.apple.HIToolbox           	0x90d33340 DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 2672
19  com.apple.HIToolbox           	0x90d321b6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
20  com.apple.HIToolbox           	0x90d5497b SendEventToEventTarget + 52
21  QtGui                         	0x00cbeca4 QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 596
22  QtCore                        	0x01a48041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
23  QtCore                        	0x01a4827d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
24  QtCore                        	0x01a4a57e QCoreApplication::exec() + 174
25  scantailor                    	0x0000719b main + 1981 (main.cpp:184)
26  scantailor                    	0x000069b2 start + 54

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib             	0x9748c982 kevent + 10
1   libSystem.B.dylib             	0x9748d09c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib             	0x9748c559 _dispatch_queue_invoke + 163
3   libSystem.B.dylib             	0x9748c2fe _dispatch_worker_thread2 + 240
4   libSystem.B.dylib             	0x9748bd81 _pthread_wqthread + 390
5   libSystem.B.dylib             	0x9748bbc6 start_wqthread + 30

Thread 2:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01a6b958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x01a6f119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x01a7089c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x01a48041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x01a4827d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x01989dbd QThread::exec() + 157
8   scantailor                    	0x0009b744 WorkerThread::Impl::run() + 32 (WorkerThread.cpp:278)
9   QtCore                        	0x0198a776 QThreadPrivate::start(void*) + 198
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 3:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01a6b958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x01a6f119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x01a7089c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x01a48041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x01a4827d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x01989dbd QThread::exec() + 157
8   scantailor                    	0x0004e960 ThumbnailPixmapCache::Impl::run() + 28 (ThumbnailPixmapCache.cpp:549)
9   QtCore                        	0x0198a776 QThreadPrivate::start(void*) + 198
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 4:
0   libSystem.B.dylib             	0x974a1ad2 select$DARWIN_EXTSN$NOCANCEL + 10
1   libSystem.B.dylib             	0x97539fd7 select + 92
2   QtCore                        	0x01a6b958 qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) + 168
3   QtCore                        	0x01a6f119 QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) + 441
4   QtCore                        	0x01a7089c QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 156
5   QtCore                        	0x01a48041 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 65
6   QtCore                        	0x01a4827d QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 189
7   QtCore                        	0x01989dbd QThread::exec() + 157
8   scantailor                    	0x00007e2f BackgroundExecutor::Impl::run() + 17 (BackgroundExecutor.cpp:151)
9   QtCore                        	0x0198a776 QThreadPrivate::start(void*) + 198
10  libSystem.B.dylib             	0x9749385d _pthread_start + 345
11  libSystem.B.dylib             	0x974936e2 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x016c18e0  ebx: 0x011b7b35  ecx: 0x00ea3bbb  edx: 0x00000000
  edi: 0x031c15b0  esi: 0x031c1744  ebp: 0xbfffdf98  esp: 0xbfffdf98
   ss: 0x0000001f  efl: 0x00010283  eip: 0x00ea3bc8   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x00000008
Removing that connect statement for menuAboutToHide() removes all the crashing, and allows the menu items to work, but once the menu comes and goes (without selecting an option) you can't get it back without switching tabs and coming back. :)

I guess it's back to basics . . . I'll have to put in some debug statements to better track what is getting called and in what order to find out why it is crashing.
Last edited by n9yty on 28 Oct 2010, 09:09, edited 1 time in total.

Tulon
Posts: 687
Joined: 03 Oct 2009, 06:13
Number of books owned: 0
Location: London, UK
Contact:

Re: Mac problem - contextual menus cause crash

Post by Tulon » 27 Oct 2010, 18:30

Let's test a hypothesis of mine.
Let's add the following to the destructor of ZoneContextMenuInteraction:

Code: Select all

m_ptrMenu.release()->deleteLater();
If it helps, it does indicate a bug in Qt. This workaround is a clean one, so I will be committing it to my production code if it helps.
Scan Tailor experimental doesn't output 96 DPI images. It's just what your software shows when DPI information is missing. Usually what you get is input DPI times the resolution enhancement factor.

User avatar
n9yty
Posts: 72
Joined: 25 Jul 2010, 22:13

Re: Mac problem - contextual menus cause crash

Post by n9yty » 27 Oct 2010, 20:02

That change makes no difference in behavior here.

Just to be sure, this is where/how I inserted it:

Code: Select all

ZoneContextMenuInteraction::~ZoneContextMenuInteraction()
{
	m_ptrMenu.release()->deleteLater();
}
As to the timing of the signals, is the hide or trigger supposed to fire first? If I am in the debugger and I do a return as soon as it enters the menuAboutToHide() call, and then continue, the trigger is called and then works, but menuAboutToHide() is not called after that again.

Post Reply