On Thu, 15 Jun 2023 02:31:39 +0200 ichthyo <[email protected]> wrote:
>Am 14.06.23 um 14:15 schrieb Will Godfrey: >> There is also an issue created on github from a BSD user who cant get Yoshimi >> running. > >https://github.com/Yoshimi/yoshimi/issues/183 > >> At the moment I can't get my head round this, > > >....me neither, the report looks puzzling. > >The Stacktrace indicates that Yoshimi started up regularly >and went ahead to launch the UI > > >in main.cpp, line 266 > > if (bShowGui) > { > MasterUI *guiMaster = _synth->getGuiMaster(false); > if (guiMaster) > { >... >... > } > else > GuiThreadMsg::processGuiMessages(); > > > >GuiThreadMsg::processGuiMessages() > ... > guiMaster->Init( ... ); > > >MasterUI::Init(const char *_label) > ... > configui = new ConfigUI(synth); > > >ConfigUI::ConfigUI(SynthEngine *_synth) > synth = _synth; > manageThemes(); > > >ConfigUI::manageThemes() > ... > ... down to the last line > setClassicTable() > > >ConfigUI::setClassicTable() > > setColourLine(colourData[lineCount + 1], lineCount, 1); > > setGreyScale(colourData[0]); > int lineCount = 0; > while (colourData[lineCount + 1].substr(0, 7) != "-------") > { > setColourLine(colourData[lineCount + 1], lineCount, 1); > ++ lineCount; > } > > >The SEGFAULT then happens while copying the by-value argument string, >i.e. while processing the expression > > > colourData[lineCount + 1] > > > >Now I am not familiar with the theme handling code, so I don't really >understand what is supposed to happen in that loop. Am I correct >that this string Array "colourData" is in static memory, and defined >in Themes.h ? > >Because, what puzzles me, this array does not have any line starting >with "-------", only a line starting with "=================== data end marker" > >This is other than the file "classic.clr" (installed with Yoshimi), >which does hold a line "------------------ data start marker" > >Probably I am mixing something up here, but if that observation is correct, >than this loop will go on forever, read beyond the end of the array and at >some point just leave the static memory block loaded from the binary, >at which point it will trigger a SEGFAULT. > >So, to be safe, that loop might better include a upper limit on the >lineCount variable, based on the length of that array. But, as said, >I did not yet look in detail into this theme handling code, thus I >do not understand what is supposed to happen there when Yoshimi >starts up regularly from a proper installation. > >-- Hermann > I think I've found it! Uniquely the Classic.clr theme doesn't need the start and end markers as it traverses the array directly, using the size value COLOURLIST. However this number is wrong! It is set as 115, while there are only 114 entries, so always over-counts by 1. Somehow this wasn't producing any problems for me, or any of the people who've tried it under Linux (presumably using GCC). Setting this to 114, traversed the entire array correctly, but then missed the last entry for loaded theme files. Adjusting the setUserTable() code in ConfigUI.fl was all that was needed to put that right. Presumably either Clang, or BSD is less forgiving when hitting an undefined entry in an array! The annoying thing is that I'll now have to push out a bugfix release so soon :( -- Will J Godfrey {apparently now an 'elderly'} https://willgodfrey.bandcamp.com/ http://yoshimi.github.io Say you have a poem and I have a tune. Exchange them and we can both have a poem, a tune, and a song. _______________________________________________ Yoshimi-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/yoshimi-devel
