<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - macOS: libreoffice crash on startup, VCL thread mutex condition"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=103690#c57">Comment # 57</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - macOS: libreoffice crash on startup, VCL thread mutex condition"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=103690">bug 103690</a>
              from <span class="vcard"><a class="email" href="mailto:tml@iki.fi" title="Tor Lillqvist <tml@iki.fi>"> <span class="fn">Tor Lillqvist</span></a>
</span></b>
        <pre>I think the essential thing in the tracebacks that hasn't bee mentioned (?) is
the -[VCL_NSApplication screenParametersChanged:] line. For some reason, on
some machines, that notification gets called too early before the SolarMutex
has been set up (and VCL initialised in general).

However, I could not reproduce it directly on my machine, using any of the
hints above (tried both running
"instdir/LibreOfficeDev.app/Contents/MacOS/soffice", "open
instdir/LibreOfficeDev.app", and even putting it into the Dock and clicking
that. The screenParametersChanged: method does not get called.

I think in some other Mac crash bug report I have seen mentions that if the
Dock has been resized to a non-standard size you would get crashes, so I tried
that, too. I even tried resizing it back and forth while LO was starting, and
with the machine loaded with a LO build with make -j10. But no crash.

But, if I add a sleep(5) in initNSApp() (vcl/osx/salinst.cxx):

<span class="quote">>    [[NSNotificationCenter defaultCenter] addObserver: NSApp
>                                          selector: @selector(screenParametersChanged:)
>                                          name: NSApplicationDidChangeScreenParametersNotification
>                                          object: nil ];
>    SAL_DEBUG("     sleeping a bit");
>    sleep(5);
>    SAL_DEBUG("     slept");</span >

and then change the Dock size in System Preferences while LO is sleeping,
Boom!. The backtrace is exactly as mentioned here.

I guess it is possible that some machines have some modifications to settings,
or particular hardware or software, that causes the system to send all apps a
NSApplicationDidChangeScreenParametersNotification when they start, and in the
LibreOffice case that arrives before it is ready.

So, the fix to this bug is probably to move the notification addObserver: calls
to some later point, after VCL and the SolarMutex have been initialised. Will
experiment.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>