[vlc-devel] Running interface on the main thread

Juho Vähä-Herttua juhovh at iki.fi
Thu Jun 17 09:25:08 CEST 2010


Hi,

I want to experiment a bit with running the Qt4 interface on Mac. Originally I had Qt4 binaries compiled with Carbon (old 32-bit MacOS based GUI framework) and it worked somewhat, but crashed from time to time and there was no video. With Laurent's help I fixed the vout module to work with Qt4 but that required the latest Qt4 binaries compiled with Cocoa (the NeXTStep based GUI framework, default now). I ran into a major issue with it though:

The Cocoa framework main loop wants to be run on the main thread. VLC right now spawns a new thread for interface and calls QCoreApplication::exec there, which seems to break. Is there any possibility to move the interface code into the main thread? Right now the main() is in sigwait() state. Even Qt4 documentation seems to always refer QCoreApplication::exec running in the main() function, I think there's a possibility that this might cause problems on other systems as well. 


Juho


Error message for clarification:

2010-06-17 01:25:48.321 VLC[92554:1a03] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-751.21/Misc.subproj/NSUndoManager.m:271
2010-06-17 01:25:48.326 VLC[92554:1a03] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2010-06-17 01:25:48.339 VLC[92554:1a03] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /SourceCache/Foundation/Foundation-751.21/Misc.subproj/NSUndoManager.m:271
2010-06-17 01:25:48.340 VLC[92554:1a03] An uncaught exception was raised
2010-06-17 01:25:48.340 VLC[92554:1a03] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2010-06-17 01:25:48.445 VLC[92554:1a03] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x95634bda __raiseError + 410
	1   libobjc.A.dylib                     0x93167509 objc_exception_throw + 56
	2   CoreFoundation                      0x95634908 +[NSException raise:format:arguments:] + 136
	3   Foundation                          0x95d96dc3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
	4   Foundation                          0x95ce2e3d +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 160
	5   AppKit                              0x91428afb -[NSApplication run] + 577
	6   QtGui                               0x04ab6d21 _ZN19QEventDispatcherMac13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE + 1505
	7   QtCore                              0x05716181 _ZN10QEventLoop13processEventsE6QFlagsINS_17ProcessEventsFlagEE + 65
	8   QtCore                              0x057164ba _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE + 170
	9   QtCore                              0x05717b56 _ZN16QCoreApplication4execEv + 182
	10  libqt4_plugin.dylib                 0x047ce097 _ZL6ThreadPv + 1127
	11  libSystem.B.dylib                   0x97cd1a19 _pthread_start + 345
	12  libSystem.B.dylib                   0x97cd189e thread_start + 34
)
Trace/BPT trap


More information about the vlc-devel mailing list