Opened 8 years ago

Closed 8 years ago

Last modified 2 years ago

#51287 closed defect (fixed)

Inkscape crashes on startup if enchant is installed with +applespell — at Version 9

Reported by: Blokkendoos (Johan) Owned by: devans@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: lion Cc: raimue@…
Port: inkscape enchant

Description (last modified by dbevans (David B. Evans))

Inkscape 0.91_14 crashes on startup. OS X 10.8.5 XCode 5.1.1

From the log (attached) this seems to be related to enchant_applespell.

Workaround: Uninstall of enchant +applespell Install enchant +aspell -applespell

Change History (10)

Changed 8 years ago by Blokkendoos (Johan)

Attachment: inkscape Log.txt added

Inkscape crash log

comment:1 Changed 8 years ago by Blokkendoos (Johan)

Of course, the workaround is:

sudo port -f uninstall enchant +applespell
sudo port install enchant -applespell
Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:2 Changed 8 years ago by dbevans (David B. Evans)

Owner: changed from macports-tickets@… to devans@…
Status: newassigned

To help reproduce the problem, can you indicate which variants are enabled in your build (+quartz vs +x11, possibly +gtk3). Does the crash occur immediately on startup or after some other action. Thanks.

comment:3 Changed 8 years ago by Blokkendoos (Johan)

The installed port is: inkscape @0.91_14+strict+x11
The installed libenchant: enchant @1.6.0_4
IS crashes immediately after startup, showing a modal dialog that only accepts close.

Regards, Jo

comment:4 Changed 8 years ago by dbevans (David B. Evans)

Cc: raimue@… added
Port: enchant added
Summary: Inkscape crash on startup (OS X 10.8)Inkscape crashes on startup if enchant is installed with +applespell
Version: 2.3.4

Thanks, Jo.

After a lot of fooling around I was able to reproduce your problem on 10.8. As you suggest, there is a problem using the AppleSpell backend with enchant. The crash occurs when gtkspell attempts to initialize enchant when enchant has been built with this backend. The error that occurs is symptomatic of the situation where an object has been allocated but prematurely freed before being used. By this time, the original pointer has been reallocated to something else (NSCFType in this case) which doesn't accept the selector from the original object call. So the crash is an enchant/AppleSpell problem.

From the inkscape point of view, this is all moot because the inkscape code assumes that enchant has been installed with the aspell backend. If aspell is not installed at build time inkscape will disable the spell check functionality, partially at least, by not including the SpellCheck menu item in the Text menu. Unfortunately the text window code will still try and initialize gtkspell (and thereby enchant) if gtkspell is installed regardless of whether aspell is installed. These two need to be coordinated in inkscape to avoid problems. I note that this is a new error because enchant was recently modified to install the AppleSpell backend by default rather than aspell as it did previously. Need to review this too.

At any rate, in order for spell checking to work in inkscape, you need to do the following:

  • Make sure that aspell is installed with at least one language dictionary. This dictionary should correspond to whatever language your machine is configured to use.
  • Make sure that enchant is installed with the aspell backend AND that the AppleSpell backend is NOT installed. Currently this means enchant +aspell -applespell. Note that, as currently configured, enchant will install aspell and the aspell English dictionary, aspell-dict-en, if they are not already installed.
  • Once aspell and enchant are properly installed, you need to rebuild inkscape so it will properly configure spell checking.

Command sequence for this would be:

sudo port install aspell aspell-dict-xx
sudo port install enchant +aspell -applespell
sudo port -n upgrade --force inkscape

This allows inkscape to start up without errors for me and spell checking works. You should see SpellChecking at the bottom of the text menu and selecting it will open a spell checking dialog in the dialog pane on the right side of your screen. If you then create a text object and type in some text you should see the text echoed in the spell checking dialog and clicking the start button will cause it to start spell checking.

Please give this a try and let me know if it works for you as well. If so, I will massage the relevant ports as necessary to ensure that inkscape installs this way by default.

Copying raimue as he made the change in enchant (r145039) that precipitated this issue. Due to this issue, I would prefer to see enchant +aspell as the default variant, at least until the AppleSpell crash issue is resolved.

comment:5 Changed 8 years ago by Blokkendoos (Johan)

Confirmed. The suggested command sequence results in Inkscape not crashing _and_ supporting spellchecking functionality.
Thanks for the swift response.

Regards,
Jo.

PS On laptop with OS X 10.10.5, Inkscape is allright with these ports installed:

 enchant @1.6.0_4+applespell (active)
 inkscape @0.91_13+strict+x11 (active)
Last edited 8 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 Changed 8 years ago by raimue (Rainer Müller)

Thank you for the analysis, David.

The idea of switching to enchant +applespell as default was meant to reduce the setup overhead for new users. As spell checking in the system is already configured for local language, users do not need to install extra dictionaries. Also, suggestions and custom additions would be adopted automatically.

It is interesting to see it actually crashes inside the call for [NSSpellChecker sharedSpellChecker], which is provided by AppKit.framework. I don't think we have any more influence on the underlying libraries. This crash might even be specific to OS X 10.8.

To add some data point, I cannot reproduce this crash on OS X 10.10.5 Yosemite:

$ port -q installed enchant inkscape
  enchant @1.6.0_4+applespell (active)
  inkscape @0.91_14+strict+x11 (active)

For the inkscape issue, it looks like inkscape picks up aspell on build time opportunistically without declaring a dependency. This functionality should be disabled or the explicit dependency must be added.

comment:7 in reply to:  6 ; Changed 8 years ago by dbevans (David B. Evans)

Replying to raimue@…:

Thank you for the analysis, David.

The idea of switching to enchant +applespell as default was meant to reduce the setup overhead for new users. As spell checking in the system is already configured for local language, users do not need to install extra dictionaries. Also, suggestions and custom additions would be adopted automatically.

It is interesting to see it actually crashes inside the call for [NSSpellChecker sharedSpellChecker], which is provided by AppKit.framework. I don't think we have any more influence on the underlying libraries. This crash might even be specific to OS X 10.8.

To add some data point, I cannot reproduce this crash on OS X 10.10.5 Yosemite:

$ port -q installed enchant inkscape
  enchant @1.6.0_4+applespell (active)
  inkscape @0.91_14+strict+x11 (active)

Same here so it appears to be OS X version dependent. I can check 10.8+ but not earlier.

For the inkscape issue, it looks like inkscape picks up aspell on build time opportunistically without declaring a dependency. This functionality should be disabled or the explicit dependency must be added.

Agreed. The current dependencies were based on the expectation that enchant would configure with aspell by default (as it used to). The problem is that inkscape does the spellchecking in two pieces. It uses gtkspell -> enchant to transparently check spelling and underline spelling errors on the contents the text widget used to display a text object but then accesses aspell directly (not via enchant) to find suggested spellings, add to the dictionary, etc. Basically everything that is done in the spell checking dialog in the side pane. So for things to work consistently, enchant needs to be configured with aspell. Not great.

In addition, during configuration they use the presence of aspell to indicate that the spell checking item should be enabled in the text menu but use an independent check for gtkspell to enable its use in the text widget. So it will try to use gtkspell even if aspell isn't available. A few things to think about upstream.

I can use require_active_variants to mandate enchant +aspell but that will break the default build on the buildbots if enchant isn't configured with aspell by default. As the port description says, enchant was originally designed to use an aspell-like API. I believe this is generally the default on most Linux platforms.

If applespell didn't break on 10.8, I'd suggest enchant +applespell +aspell by default.

comment:8 in reply to:  7 Changed 8 years ago by raimue (Rainer Müller)

Replying to devans@…:

Same here so it appears to be OS X version dependent. I can check 10.8+ but not earlier.

We could make the default variant OS-dependent, as OS X <= 10.8 should be considered legacy anyway.

I can use require_active_variants to mandate enchant +aspell but that will break the default build on the buildbots if enchant isn't configured with aspell by default. As the port description says, enchant was originally designed to use an aspell-like API. I believe this is generally the default on most Linux platforms.

If applespell didn't break on 10.8, I'd suggest enchant +applespell +aspell by default.

Enabling both +aspell +applespell by default will effectively use aspell for everything. The default configuration in enchant.ordering prefers any other backend over AppleSpell for most languages.

This upstream report seems relevant: https://bugs.launchpad.net/inkscape/+bug/1049548

Looking only at inkscape, going back to enchant +aspell would be the easy solution. The list of dependents of enchant includes gimp2 and webkit*-gtk*. However, I am in doubt whether they are actually used more often for spell checking than inkscape. Going back to enchant +aspell as default would only loose the tighter system integration.

comment:9 Changed 8 years ago by dbevans (David B. Evans)

Description: modified (diff)
Resolution: fixed
Status: assignedclosed

I've updated the dependencies in inkscape in r148331, requiring enchant +aspell -applespell. This fixes the spell checking issue reported here although enchant has to be manually installed with these variants for the build to succeed. Will do the same for inkscape-devel shortly.

Leaving enchant variants as they are for now although I may resurrect the issue in another ticket after I do some more research into how it's used in other ports. Thanks to raimue for his input.

Note: See TracTickets for help on using tickets.