Question about fix of #1503 (Release build with no libsndfile)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about fix of #1503 (Release build with no libsndfile)

Yves Guillemot
The bug should be fixed in rev. 14518. (At least it's fixed on my system).

Some objects related to audio files read and write are now explicitely in main.

Previously they was defined as static and no more initialized when their code
was included in a static library.
This is why the bug was not visible in debug mode which doesn't use a static
library.

If other static objects exist they should cause other bugs which are only
visible in release build.
Currently I only found the four of them involved in #1503 and I presume such
static (or global) objects are scarce in RG code.
Nevertheless there is more than 600 .cpp files in RG code.

Does anybody know some tool we can use to find such static/global objects in RG
code ?

Yves


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Rosegarden-devel mailing list
[hidden email] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
Reply | Threaded
Open this post in threaded view
|

Re: Question about fix of #1503 (Release build with no libsndfile)

David Faure
On Sunday 14 February 2016 21:57:33 Yves Guillemot wrote:

> The bug should be fixed in rev. 14518. (At least it's fixed on my system).
>
> Some objects related to audio files read and write are now explicitely in main.
>
> Previously they was defined as static and no more initialized when their code
> was included in a static library.
> This is why the bug was not visible in debug mode which doesn't use a static
> library.
>
> If other static objects exist they should cause other bugs which are only
> visible in release build.
> Currently I only found the four of them involved in #1503 and I presume such
> static (or global) objects are scarce in RG code.
> Nevertheless there is more than 600 .cpp files in RG code.
>
> Does anybody know some tool we can use to find such static/global objects in RG
> code ?

In theory,
nm --demangle librosegardenprivate.so | grep GLOBAL
is the answer. It shows all the files with a global object. However there's
a complication: the <iostream> header defines a global object
  static ios_base::Init __ioinit;
which means any cpp file that includes <iostream> has at least one global object,
so the result from the above grep is a very long list.

The only way I know to find out more is to run elf-dissector, written by my colleague Volker
(git clone git://anongit.kde.org/elf-dissector). It shows the same list as above when
clicking on the .init_array entry, but instead you can go to
_Z41__static_initialization_and_destruction_0ii
which shows the code of the global initialization function.
Copy/pasting that and grepping for Source gives the following result:

Source: /s/kde/src/4/rosegarden-git/src/document/io/MusicXmlExportHelper.cpp:1561
Source: /s/kde/src/4/rosegarden-git/src/sound/SoundFile.h:39
Source: /s/kde/src/4/rosegarden-git/src/sound/SoundFile.h:39
Source: /s/kde/src/4/rosegarden-git/src/sound/SoundFile.h:40
Source: /s/kde/src/4/rosegarden-git/src/sound/SoundFile.h:41
Source: /s/kde/src/4/rosegarden-git/src/sound/SoundFile.h:43
Source: /s/kde/src/4/rosegarden-git/src/sound/SoundFile.h:44
Source: /s/kde/src/4/rosegarden-git/src/sound/Midi.h:35
Source: /s/kde/src/4/rosegarden-git/src/sound/Midi.h:36

Indeed I found this:
 src/document/io/LilyPondExporter.h:const std::string headerDedication = "dedication";
 src/sound/Midi.h:const std::string MIDI_TRACK_HEADER             = "MTrk";

These should be a const char[] and it should be in a .cpp file.

src/base/MidiDevice.cpp:    static std::string controls[][9] = {
src/base/SoftSynthDevice.cpp:    static std::string controls[][9] = {
src/sound/MidiFile.cpp:static const std::string defaultTrackName = "Imported MIDI";

All these should be char[] instead of std::string.

I wonder why the one in LilypondExporter.h didn't show up, I found it with more clicking.
Needs further investigation, after the above is fixed.

--
David Faure, [hidden email], http://www.davidfaure.fr
Working on KDE Frameworks 5


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Rosegarden-devel mailing list
[hidden email] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel