File tree Expand file tree Collapse file tree 5 files changed +58
-1
lines changed
Expand file tree Collapse file tree 5 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ if you don't have it):
7373
7474 bundle install
7575
76- Regenerate SWIG wrappers if you made changes in ` .i ` files (use version 3.0.7 of SWIG):
76+ Regenerate SWIG wrappers if you made changes in ` .i ` files (use version 3.0.7 of SWIG - 3.0.8 through 3.0.12 will not work ):
7777
7878 rake swig
7979
Original file line number Diff line number Diff line change 8686 SWIG_RubyRemoveTracking (properties);
8787 }
8888
89+ TagLib::List<TagLib::FLAC::Picture *> list = file->pictureList ();
90+ for (TagLib::List<TagLib::FLAC::Picture *>::ConstIterator it = list.begin (); it != list.end (); it++) {
91+ TagLib::FLAC::Picture *picture = (*it);
92+ SWIG_RubyUnlinkObjects (picture);
93+ SWIG_RubyRemoveTracking (picture);
94+ }
95+
8996 SWIG_RubyUnlinkObjects (ptr);
9097 SWIG_RubyRemoveTracking (ptr);
9198
Original file line number Diff line number Diff line change @@ -2210,6 +2210,13 @@ SWIGINTERN void TagLib_FLAC_File_close(TagLib::FLAC::File *self){
22102210 SWIG_RubyRemoveTracking (properties);
22112211 }
22122212
2213+ TagLib::List<TagLib::FLAC::Picture *> list = file->pictureList ();
2214+ for (TagLib::List<TagLib::FLAC::Picture *>::ConstIterator it = list.begin (); it != list.end (); it++) {
2215+ TagLib::FLAC::Picture *picture = (*it);
2216+ SWIG_RubyUnlinkObjects (picture);
2217+ SWIG_RubyRemoveTracking (picture);
2218+ }
2219+
22132220 SWIG_RubyUnlinkObjects (ptr);
22142221 SWIG_RubyRemoveTracking (ptr);
22152222
Original file line number Diff line number Diff line change 1+ require File . join ( File . dirname ( __FILE__ ) , 'helper' )
2+
3+ class TestFlacPictureMemory < Test ::Unit ::TestCase
4+
5+ N = 10000
6+
7+ context "TagLib::FLAC::Picture" do
8+
9+ setup do
10+
11+ end
12+
13+ should "release memory when closing flac file with picture data" do
14+ c = 0
15+ N . times do
16+ TagLib ::FLAC ::File . open ( "test/data/flac.flac" , false ) do |f |
17+ f . picture_list . each do |p |
18+ x = p . data
19+ c = c + 1
20+ end
21+ end
22+ end
23+ assert_equal N , c
24+ end
25+
26+ should "process a flac file without picture data" do
27+ c = 0
28+ N . times do
29+ TagLib ::FLAC ::File . open ( "test/data/flac_nopic.flac" , false ) do |f |
30+ f . picture_list . each do |p |
31+ x = p . data
32+ c = c + 1
33+ end
34+ end
35+ end
36+ assert_equal 0 , c
37+ end
38+
39+ teardown do
40+
41+ end
42+ end
43+ end
You can’t perform that action at this time.
0 commit comments