Project Settings/Section Types disappeared again

Once more, the Project Settings/Section Types have disappeared in one of my Scrivener projects (v3.01 (966)). (Default Types by Structure is also empty.)

This problem has occurred before.

I’m not sure why it happens, but I think it’s connected to having multiple project open simultaneously.

Unfortunately I need a reproduction case to track this down, because I have never been able to reproduce it and can find nothing obvious in the code that would cause this. (Obviously there’s a bug in the code somewhere, but it’s hidden and possibly triggered by more than one factor.)

Could you please go to the “General” pane of the Preferences and under “Warnings” turn on “Show internal error alerts”. I’m curious if there will be an error thrown when this happens - let me know if there is if you can get this to happen again, or if you can find a way of consistently reproducing the issue.

Thanks and all the best,
Keith

This is so strange. Some questions:

  1. Had you edited an project settings and hit “OK” at some point before the types disappeared? (The only time they are ever saved is when you hit OK in the Project Settings.)

  2. Once you saw they were missing, did you hit “OK” or “Cancel” before quitting and reloading the project?

  3. When you noticed they were empty, did you look at other panes in the Project Settings, such as Labels? Were they okay?

One of the following must be going on:

  1. Some change to the Project Settings you make causes the Section Types to be wiped on “OK”.

  2. Some weird bug causes Section Types not to be loaded into the Project Settings when you open the panel, so that when you hit “OK” on closing it, the Section Types are wiped. (This can be ruled out if you definitely hit “Cancel” and not “OK” after you saw the Section Types were missing.

  3. Some weird bug is causing Section Types not to be saved into the project data.

The trouble is that I’ve checked these areas of code and cannot for the life of me see anything that would wipe the Section Types like this. The nearest I can see is if the project itself wasn’t available or was empty, but that’s not possible at the time you invoke the Project Settings.

Thanks!

Thanks for the info. Okay, I think I might be part way there, but not entirely, based on the clue of having other projects open. Different classes in Scrivener set themselves up as observers of different events, and the Section Types controller object listens for the associated project closing, at which point it cleans itself up. However, there’s a bug in the code where it’s not checking that it’s the current project that is closing - so it cleans itself up (empties itself) when any project is closed.

To see what I mean, try this:

  1. Create a test project that you don’t mind messing up.

  2. Open Project Settings.

  3. Change some of the Section Type names and add some new ones so that they are no longer the defaults.

  4. Click “OK”.

  5. Close and reopen the project (not necessary but shows that it’s from fresh).

  6. Open and close any other project (or just close a project you already had opened - not the one you just created, though).

  7. Open Project Settings in the test project again.

Pouf! Section Types are empty. (This also works if you open Project Settings and close another project while Project Settings are open.)

However, even if I click “OK” at this point, when I close and reopen the project, the Section Types are restored. So there must be some other factor, too. Maybe this will provide you with the clue to what other factor might be involved, though?

Thanks and all the best,
Keith

EDIT: You beat me to it. The strange thing is that even if I hit “OK” the Section Types are restored when I reload - what version of macOS are you on?