Project Settings/Section Types disappeared again

User avatar
auxbuss
Posts: 127
Joined: Mon Nov 30, 2015 9:50 pm
Platform: Mac
Contact:

Sun Jan 14, 2018 8:45 pm Post

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.
Attachments
Screen Shot 2018-01-14 at 20.34.34.png
Screen Shot 2018-01-14 at 20.34.34.png (125.13 KiB) Viewed 1143 times
Image

User avatar
KB
Site Admin
Posts: 20118
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Mon Jan 15, 2018 4:58 pm Post

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
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

User avatar
auxbuss
Posts: 127
Joined: Mon Nov 30, 2015 9:50 pm
Platform: Mac
Contact:

Mon Jan 15, 2018 5:14 pm Post

I'll have a fiddle about tomorrow with the setting you suggest. Appreciate it's an odd one.

Further info: Section Types repopulated after reloading Scriv (I presume to the defaults). Default Types and Structure was wiped (again, I presume to the defaults).
Image

User avatar
KB
Site Admin
Posts: 20118
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Mon Jan 15, 2018 7:26 pm Post

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!
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

User avatar
auxbuss
Posts: 127
Joined: Mon Nov 30, 2015 9:50 pm
Platform: Mac
Contact:

Mon Jan 15, 2018 8:16 pm Post

KB wrote: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?

To (1): Yes. I removed an entry from the Auto-Complete List.
(2): Yes, probably Cancel.
(3): Yes. All other Project Settings are unchanged (of those I've changed: Label List, Auto-Complete List, Special Folders).

KB wrote: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.

The first time I saw this was when experimenting with tabbed windows days after S3 came out, and I was trying out the new compile system for the first time. I noticed then that Section Types was empty and, not knowing the set-up then, I just reloaded thinking it was some edge case that would get swept up at some point. (And you had plenty going on that I didn't want to add to the list if no one else was having a problem.)

More fyi: The affected project is a completed novel draft that was converted from S2 (so fairly chunky). The second project was also converted from S2, but is a tiny "idea" project and has never been compiled. I've been working on the affected project on and off since S3 without any problems. The multiple projects open thing might be coincidental, of course.
Image

User avatar
auxbuss
Posts: 127
Joined: Mon Nov 30, 2015 9:50 pm
Platform: Mac
Contact:

Mon Jan 15, 2018 8:36 pm Post

I can reproduce this now.

  • Open any project.
  • Open a second project then close it.
  • Project Settings/Section Types is blank.

I think that as long as you don't OK Project Settings, then a reload will fix.
Image

User avatar
KB
Site Admin
Posts: 20118
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Mon Jan 15, 2018 9:00 pm Post

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).

5. 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?
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

User avatar
auxbuss
Posts: 127
Joined: Mon Nov 30, 2015 9:50 pm
Platform: Mac
Contact:

Mon Jan 15, 2018 9:08 pm Post

KB wrote: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?

macOS: 10.13.2

I've not dug further into when Default Types by Structure gets blown away. I do know that it's happened twice, though – including yesterday – since resetting is a nuisance thus memorable.
Image