GC: forcing GC OFF because OBJC_DISABLE_GC is set

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

GC: forcing GC OFF because OBJC_DISABLE_GC is set

Postby pupeno » Tue Mar 17, 2015 4:26 pm

Hello,

I'm trying to run CEF in a screensaver, which is essentially a plug in/library. In the plug in initialization I'm doing this:

Code: Select all
    // Fake a command line.
    char* argv[1];
    argv[0] = (char *)"Screensaver";
    CefMainArgs main_args(1, argv);

    // CACefApplication implements application-level callbacks. It will create the first browser instance in OnContextInitialized() after CEF has initialized.
    CefRefPtr<CACefApplication> app(new CACefApplication);

    // Specify CEF global settings here.
    CefSettings settings;

    // Initialize CEF for the browser process.
    CefInitialize(main_args, settings, app.get(), NULL);


and when I added that last line is when it started crashing regarding the Garbage Collector. This is using Swift and the 10.9 SDK, so, it's using ARC. Is there something I should know about CEF in this environment? Any ideas what's going on?

This is the full error and stack trace:


Code: Select all
Application Specific Information:
com.apple.preference.desktopscreeneffect v.5.1 (Desktop & Screen Saver)
objc[48906]: GC: forcing GC OFF because OBJC_DISABLE_GC is set

Application Specific Signatures:
Ninja

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.chromium.ContentShell.framework   0x0000000116530af7 base::debug::BreakDebugger() + 23
1   org.chromium.ContentShell.framework   0x00000001165b464b logging::LogMessage::~LogMessage() + 939
2   org.chromium.ContentShell.framework   0x00000001165b3333 logging::LogMessage::~LogMessage() + 35
3   org.chromium.ContentShell.framework   0x00000001165b5c29 base::mac::AssignOverridePath(base::FilePath const&, NSBundle**) + 425
4   org.chromium.ContentShell.framework   0x00000001165b5cca base::mac::SetOverrideFrameworkBundlePath(base::FilePath const&) + 42
5   org.chromium.ContentShell.framework   0x000000011639ac18 (anonymous namespace)::OverrideFrameworkBundlePath() + 40
6   org.chromium.ContentShell.framework   0x000000011639989a CefMainDelegate::BasicStartupComplete(int*) + 58
7   org.chromium.ContentShell.framework   0x000000011e877ba4 content::ContentMainRunnerImpl::Initialize(content::ContentMainParams const&) + 516
8   org.chromium.ContentShell.framework   0x000000011629e43e CefContext::Initialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>, void*) + 1262
9   org.chromium.ContentShell.framework   0x000000011629deae CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>, void*) + 414
10  org.chromium.ContentShell.framework   0x000000011614fca6 cef_initialize + 646
11  com.carouselapps.Ninja           0x0000000115fbeaf4 CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>, void*) + 388 (libcef_dll_wrapper.cc:161)
12  com.carouselapps.Ninja           0x0000000115f3a1e3 +[Global cefMainArgs] + 227 (cpp_bridge.mm:30)
13  com.carouselapps.Ninja           0x0000000115f2ebad _TFC5Ninja9NinjaViewcfMS0_FT5frameVSC6CGRect9isPreviewSb_S0_ + 2893 (NinjaView.swift:55)
14  com.carouselapps.Ninja           0x0000000115f30c33 _TToFC5Ninja9NinjaViewcfMS0_FT5frameVSC6CGRect9isPreviewSb_S0_ + 99
15  com.apple.ScreenSaver            0x00007fff90c6e5f5 -[ScreenSaverModules loadModule:frame:isPreview:] + 987
16  com.apple.preference.desktopscreeneffect.screeneffects   0x0000000111505335 0x1114fc000 + 37685
17  com.apple.preference.desktopscreeneffect.screeneffects   0x000000011150579c 0x1114fc000 + 38812
18  com.apple.preference.desktopscreeneffect.screeneffects   0x0000000111506b9c 0x1114fc000 + 43932
19  com.apple.preference.desktopscreeneffect.screeneffects   0x0000000111507005 0x1114fc000 + 45061
20  com.apple.AppKit                 0x00007fff8dd745d5 -[NSCollectionViewItem _setSelectedWithoutNotification:] + 35
21  com.apple.CoreFoundation         0x00007fff8d130385 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 133
22  com.apple.CoreFoundation         0x00007fff8d12fa89 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 313
23  com.apple.AppKit                 0x00007fff8dd7ffe7 -[NSCollectionView _applySelectionIndexes:toItems:] + 91
24  com.apple.AppKit                 0x00007fff8dd803ae -[NSCollectionView _selectObjectsAtIndexes:avoidsEmptySelection:] + 443
25  com.apple.AppKit                 0x00007fff8dd78afc -[NSCollectionView mouseDown:] + 649
26  com.apple.AppKit                 0x00007fff8d740ccd forwardMethod + 126
27  com.apple.AppKit                 0x00007fff8d740ccd forwardMethod + 126
28  com.apple.AppKit                 0x00007fff8dcbba18 -[NSWindow _reallySendEvent:] + 12721
29  com.apple.AppKit                 0x00007fff8d74216e -[NSWindow sendEvent:] + 446
30  com.apple.systempreferences      0x0000000108e30b12 0x108e29000 + 31506
31  com.apple.AppKit                 0x00007fff8d6f4451 -[NSApplication sendEvent:] + 4183
32  com.apple.systempreferences      0x0000000108e2ff7b 0x108e29000 + 28539
33  com.apple.AppKit                 0x00007fff8d580608 -[NSApplication run] + 711
34  com.apple.AppKit                 0x00007fff8d56ba14 NSApplicationMain + 1832
35  libdyld.dylib                    0x00007fff8f4735c9 start + 1

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib           0x00007fff8d4ff232 kevent64 + 10
1   libdispatch.dylib                0x00007fff966f6a6a _dispatch_mgr_thread + 52

Thread 2:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 3:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 4:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 5:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 6:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 7:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 8:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 9:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 10:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 11:
0   libsystem_kernel.dylib           0x00007fff8d4f94de mach_msg_trap + 10
1   libsystem_kernel.dylib           0x00007fff8d4f864f mach_msg + 55
2   com.apple.CoreFoundation         0x00007fff8d11fb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation         0x00007fff8d11effb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation         0x00007fff8d11e858 CFRunLoopRunSpecific + 296
5   com.apple.AppKit                 0x00007fff8d6f033b _NSEventThread + 137
6   libsystem_pthread.dylib          0x00007fff99bf3268 _pthread_body + 131
7   libsystem_pthread.dylib          0x00007fff99bf31e5 _pthread_start + 176
8   libsystem_pthread.dylib          0x00007fff99bf141d thread_start + 13

Thread 12:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 13:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 14:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 15:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 16:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 17:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 18:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 19:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 20:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 21:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 22:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 23:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 24:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 25:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 26:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 27:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 28:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 29:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 30:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 31:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 32:: Dispatch queue: NSOperationQueue 0x618000224900 :: NSOperation 0x60000044c3c0 (QOS: USER_INITIATED)
0   com.apple.CoreFoundation         0x00007fff8d0be888 __CFStringHash + 1144
1   com.apple.CoreFoundation         0x00007fff8d0f7971 __rehashd + 225
2   com.apple.CoreFoundation         0x00007fff8d0f776f -[__NSDictionaryM setObject:forKey:] + 911
3   com.apple.iLMBAperturePlugin2012   0x000000011298fd02 0x1128fc000 + 605442
4   com.apple.iLMBAperturePlugin2012   0x0000000112997441 0x1128fc000 + 635969
5   com.apple.iLMBAperturePlugin2012   0x000000011299c303 0x1128fc000 + 656131
6   com.apple.iLifeMediaBrowser      0x00007fff995ffa01 -[ILMediaManager _performLoadData] + 196
7   com.apple.iLifeMediaBrowser      0x00007fff995ffc20 -[ILMediaManager _loadDataThreaded] + 219
8   com.apple.CoreFoundation         0x00007fff8d0e83cc __invoking___ + 140
9   com.apple.CoreFoundation         0x00007fff8d0e8222 -[NSInvocation invoke] + 290
10  com.apple.Foundation             0x00007fff917fe2e9 -[NSInvocationOperation main] + 34
11  com.apple.Foundation             0x00007fff9175632c -[__NSOperationInternal _start:] + 653
12  com.apple.Foundation             0x00007fff91755f33 __NSOQSchedule_f + 184
13  libdispatch.dylib                0x00007fff966f3c13 _dispatch_client_callout + 8
14  libdispatch.dylib                0x00007fff966f7365 _dispatch_queue_drain + 1100
15  libdispatch.dylib                0x00007fff966f8ecc _dispatch_queue_invoke + 202
16  libdispatch.dylib                0x00007fff966f66b7 _dispatch_root_queue_drain + 463
17  libdispatch.dylib                0x00007fff96704fe4 _dispatch_worker_thread3 + 91
18  libsystem_pthread.dylib          0x00007fff99bf3637 _pthread_wqthread + 729
19  libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 33:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 34:
0   libsystem_kernel.dylib           0x00007fff8d4fe94a __workq_kernreturn + 10
1   libsystem_pthread.dylib          0x00007fff99bf140d start_wqthread + 13

Thread 35:
0   libsystem_kernel.dylib           0x00007fff8d4f94de mach_msg_trap + 10
1   libsystem_kernel.dylib           0x00007fff8d4f864f mach_msg + 55
2   com.apple.CoreFoundation         0x00007fff8d11fb34 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation         0x00007fff8d11effb __CFRunLoopRun + 1371
4   com.apple.CoreFoundation         0x00007fff8d11e858 CFRunLoopRunSpecific + 296
5   com.apple.Foundation             0x00007fff917b8849 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 278
6   com.apple.Foundation             0x00007fff917ff53e -[NSRunLoop(NSRunLoop) runUntilDate:] + 108
7   com.apple.Flurry                 0x000000010ed4912c -[AppleFlurryView startBackgroundAnimation:] + 268
8   com.apple.AppKit                 0x00007fff8d8cbd20 +[NSApplication _startDrawingThread:] + 78
9   com.apple.Foundation             0x00007fff917b690a __NSThread__main__ + 1345
10  libsystem_pthread.dylib          0x00007fff99bf3268 _pthread_body + 131
11  libsystem_pthread.dylib          0x00007fff99bf31e5 _pthread_start + 176
12  libsystem_pthread.dylib          0x00007fff99bf141d thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x5b0077c349fc61c4  rbx: 0x00007fff56dd5ea0  rcx: 0x00000000017e8000  rdx: 0x0000000000017400
  rdi: 0x0000000108e7de00  rsi: 0x0000000108e7de00  rbp: 0x00007fff56dd2cf0  rsp: 0x00007fff56dd2ce0
   r8: 0x0000000000000000   r9: 0x0000000000001400  r10: 0x000000008de6fae8  r11: 0x000000008de7ce58
  r12: 0x000060000086fd00  r13: 0x0000000116004e50  r14: 0x00007fff56dd5ea8  r15: 0x000060000029c2f0
  rip: 0x0000000116530af7  rfl: 0x0000000000000202  cr2: 0x00007ff2d3ff1000
 
Logical CPU:     2
Error Code:      0x00000000
Trap Number:     3
pupeno
Techie
 
Posts: 24
Joined: Wed Feb 25, 2015 7:48 am

Re: GC: forcing GC OFF because OBJC_DISABLE_GC is set

Postby magreenblatt » Wed Mar 18, 2015 9:34 am

Is your app organized with the proper bundle structure? See the README.txt file included with the binary distribution.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: GC: forcing GC OFF because OBJC_DISABLE_GC is set

Postby pupeno » Wed Mar 18, 2015 10:46 am

Hello magreenblatt,

Thanks for the answer. I don't have the helper application in yet, but the framework is there and accessible. I was adding code bit by bit into my screensaver and on previous occasions I had apps crash due to the bundle not being in the right format, but this one looks different.

I'll work on having other things in the bundle, but this is a .saver, not an .app, so I'm in uncharted territory already. Is there anything from that error and traceback that points to an incorrectly formatted bundle? I'm asking to learn and be able to identify errors better myself.

Thank you.
pupeno
Techie
 
Posts: 24
Joined: Wed Feb 25, 2015 7:48 am

Re: GC: forcing GC OFF because OBJC_DISABLE_GC is set

Postby magreenblatt » Wed Mar 18, 2015 11:29 am

pupeno wrote:I'll work on having other things in the bundle, but this is a .saver, not an .app, so I'm in uncharted territory already. Is there anything from that error and traceback that points to an incorrectly formatted bundle? I'm asking to learn and be able to identify errors better myself.

The different extension (.saver vs .app) is likely the problem. When you get an error message you should look up the associated source code to understand the context. For example, here's the source code for AssignOverridePath: https://code.google.com/p/chromium/code ... ns.mm&l=58.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: GC: forcing GC OFF because OBJC_DISABLE_GC is set

Postby newaira » Fri May 22, 2015 2:22 pm

I'm also struggling to get CEF working within a Mac screensaver.

It's definitely trying to load the Chromium Framework from the wrong path:

Code: Select all
Failed to load the bundle at /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/Frameworks/Chromium Embedded Framework.framework


The screensaver is essentially launched like so:
Code: Select all
/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app -background -module "screensaver"


Location of screensaver and embedded framework:
Code: Select all
screensaver: Users/<myusername>/Library/Screen Savers/screensaver.saver
CEF framework: Users/<myusername>/Library/Screen Savers/screensaver.saver/Contents/Frameworks/Chromium Embedded Framework.framework


Any idea how I could modify the cmake file or I guess the FIX_MACOSX_MAIN_FRAMEWORK_LINK macro to load the framework from the correct place without hardcoding the full path? It looks like with the relative path, the framework is loaded with respect to the ScreenSaverEngine.app executable, rather than the myscreensaver.saver bundle.
Last edited by newaira on Fri May 22, 2015 4:24 pm, edited 2 times in total.
newaira
Techie
 
Posts: 19
Joined: Sun Apr 19, 2015 7:43 pm

Re: GC: forcing GC OFF because OBJC_DISABLE_GC is set

Postby newaira » Fri May 22, 2015 4:21 pm

It looks like it's calculating the bundle path with respect to the executable rather then the screensaver bundle:
https://bitbucket.org/chromiumembedded/ ... ster#cl-66

Code: Select all
base::FilePath GetFrameworksPath() {
  // Start out with the path to the running executable.
  base::FilePath execPath;
  PathService::Get(base::FILE_EXE, &execPath);

  // Get the main bundle path.
  base::FilePath bundlePath = base::mac::GetAppBundlePath(execPath);

  // Go into the Contents/Frameworks directory.
  return bundlePath.Append(FILE_PATH_LITERAL("Contents"))
                   .Append(FILE_PATH_LITERAL("Frameworks"));
}


Is there a way to override this without altering the CEF code?
newaira
Techie
 
Posts: 19
Joined: Sun Apr 19, 2015 7:43 pm

Re: GC: forcing GC OFF because OBJC_DISABLE_GC is set

Postby magreenblatt » Fri May 22, 2015 4:41 pm

newaira wrote:It looks like it's calculating the bundle path with respect to the executable rather then the screensaver bundle. Is there a way to override this without altering the CEF code?

No, but see https://bitbucket.org/chromiumembedded/cef/issue/1532
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 56 guests