Quantcast

Heads up: an array of structs initialisation in style.cpp

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Heads up: an array of structs initialisation in style.cpp

rumpu-jussi
Hi,

I just git pulled the most recent code to my Mac and compiled the app. The result: MuseScore crashes on startup. After poking around the code, I found the culprit: the styleTypes-array initialisation in style.cpp

style.cpp:50
static const StyleType styleTypes[] {
      { StyleIdx::staffUpperBorder,        "staffUpperBorder",        Spatium(7.0)  },
      ...

The precomputeValues-function loops through the styleTypes-array, and while debugging, I noticed that only _idx-property is set. StyleType's _name is null, and it seems that the _defaultValue QVariant is empty as well.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Heads up: an array of structs initialisation in style.cpp

Jojo-Schmitz
AFAIK lasconic noticed that crash on startup on Mac (and on Mac only, for
some strange reason) but haven't jet found the time to investigate, due to
the musescore.com changes that needed his full attentuin in the past couple
days.

Most likely culprit is
https://github.com/musescore/MuseScore/commit/0b1aea952f9f870ef79f39899f8ec1
2cc2b60fa6, as per 'git blame'.

Bye, Jojo

-----Original Message-----
From: rumpu-jussi [mailto:[hidden email]]
Sent: Saturday, January 14, 2017 11:25 AM
To: [hidden email]
Subject: [Mscore-developer] Heads up: an array of structs initialisation in
style.cpp

Hi,

I just git pulled the most recent code to my Mac and compiled the app. The
result: MuseScore crashes on startup. After poking around the code, I found
the culprit: the styleTypes-array initialisation in style.cpp

style.cpp:50
static const StyleType styleTypes[] {
      { StyleIdx::staffUpperBorder,        "staffUpperBorder",      
Spatium(7.0)  },
      ...

The precomputeValues-function loops through the styleTypes-array, and while
debugging, I noticed that only _idx-property is set. StyleType's _name is
null, and it seems that the _defaultValue QVariant is empty as well.





--
View this message in context:
http://dev-list.musescore.org/Heads-up-an-array-of-structs-initialisation-in
-style-cpp-tp7580121.html
Sent from the MuseScore Developer mailing list archive at Nabble.com.

----------------------------------------------------------------------------
--
Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon
Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Heads up: an array of structs initialisation in style.cpp

rumpu-jussi
In reply to this post by rumpu-jussi
Sorry, I got too carried away. None of the values in the styleTypes-array are set. The array contains X amount of empty structs...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Heads up: an array of structs initialisation in style.cpp

lasconic
Administrator
Hi,

This part of the code is in flux. Werner is working on it. 
To make MuseScore starts, I just commented out precomputevalues() in MStyle constructor.

lasconic

2017-01-14 11:37 GMT+01:00 rumpu-jussi <[hidden email]>:
Sorry, I got too carried away. None of the values in the styleTypes-array are
set. The array contains X amount of empty structs...



--
View this message in context: http://dev-list.musescore.org/Heads-up-an-array-of-structs-initialisation-in-style-cpp-tp7580121p7580123.html
Sent from the MuseScore Developer mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Heads up: an array of structs initialisation in style.cpp

rumpu-jussi
In reply to this post by Jojo-Schmitz
It seems that with this issue we are deep in the territory of clang vs gcc implementations of global variable initialisation especially regarding an array of structs. That goes way beyond my understanding.

However, I made a quick'n'dirty workaround:

1. styleTypes is now declared as such:
static StyleType styleTypes[int(StyleIdx::STYLES)];
2. MStyle constructor has a local variable, initializer, declared as such:
          static const StyleType initializer[] {
              { StyleIdx::staffUpperBorder,        "staffUpperBorder",        Spatium(7.0)  },
              ...
3. The first thing the constructor does is to copy the values from initializer into styleTypes:
          for (int i=0;i<int(StyleIdx::STYLES);i++) {
              styleTypes[i]=initializer[i];
          }

Note that the local variable's (initializer) declaration/initialization is identical to the original styleTypes declaration. The problem here is related on how those global arrays are initialised in clang.

I may post a question to StackOverflow if there are gurus who can instruct on how to initialise a static const array of structs with clang.
Loading...