• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

dtxmania 中文


Commit MetaInfo

Revision98dab2982370a27e853abcf936fdec728371e2f5 (tree)
Zeit2020-01-08 02:30:42
Autoryyagi <yyagi.dtxmania@gmai...>
Commiteryyagi

Log Message

#34196, #38036 Quick Configでのメモリリークを修正。

Ändern Zusammenfassung

  • delete: "DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/05.\351\201\270\346\233\262/CActSelectPopupMenu.cs"

Diff

--- "a/DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/05.\351\201\270\346\233\262/CActSelectPopupMenu.cs"
+++ "b/DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/05.\351\201\270\346\233\262/CActSelectPopupMenu.cs"
@@ -61,11 +61,30 @@ namespace DTXMania
6161 this.prvFont = new CPrivateFastFont(CSkin.Path(path), (int)(18 * Scale.Y));
6262 //prvFont = new CPrivateFastFont(CSkin.Path(@"Graphics\fonts\mplus-1p-heavy.ttf"), (int)(18 * Scale.Y));
6363
64- stqMenuTitle = new stQuickMenuItem();
64+
65+ //stqMenuTitle = new stQuickMenuItem();
66+ //stqMenuTitleはprivate変数として宣言済みのため、stqMenuItemgはnewする必要なし。
67+ //newすると、QuickConfigでDrums/Guitar/Bassを切り替えるたびにstqMenuTitleが
68+ //別の変数として再初期化され、付随していたstqMenuTitle.txNameのテクスチャがDispose漏れとして検出されてしまう
69+ //(切り替えのたびにInitialize()を呼び出す設計の問題でもあるが)
70+
6571 stqMenuTitle.cItem = new COptionString(title);
6672 stqMenuTitle.cItem.label = title;
6773 //stqMenuTitle.txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(title, Color.White, Color.Black), false);
6874 //stqMenuTitle.rectName = prvFont.RectStrings;
75+
76+ // lciMenuItemsもstqMenuTitleと同様に、newの実行前に、既に紐づいているCTextureを解放しておく
77+ if (lciMenuItems != null)
78+
79+ {
80+ for (int i = 0; i < lciMenuItems.Length; i++)
81+ {
82+ if (lciMenuItems[i].txName != null)
83+ {
84+ TextureFactory.tテクスチャの解放(ref lciMenuItems[i].txName);
85+ }
86+ }
87+ }
6988 lciMenuItems = new stQuickMenuItem[menulist.Count];
7089 for (int i = 0; i < menulist.Count; i++)
7190 {
@@ -79,6 +98,8 @@ namespace DTXMania
7998
8099 bShowAllItems = showAllItems;
81100 n現在の選択行 = defaultPos;
101+
102+ this.OnManagedリソースの作成();
82103 }
83104
84105
@@ -200,21 +221,35 @@ namespace DTXMania
200221 string pathPopupMenuBackground = CSkin.Path(@"Graphics\ScreenSelect sort menu background.png");
201222 if (File.Exists(pathCursor))
202223 {
203- this.txCursor = TextureFactory.tテクスチャの生成(pathCursor, false);
224+ if (this.txCursor != null)
225+ {
226+ TextureFactory.tテクスチャの解放(ref this.txCursor);
227+ }
228+ this.txCursor = TextureFactory.tテクスチャの生成(pathCursor, false, "txCursor");
204229 }
205230 if (File.Exists(pathPopupMenuBackground))
206231 {
207- this.txPopupMenuBackground = TextureFactory.tテクスチャの生成(pathPopupMenuBackground, false);
232+ if (this.txPopupMenuBackground != null)
233+ {
234+ TextureFactory.tテクスチャの解放(ref this.txPopupMenuBackground);
235+ }
236+ this.txPopupMenuBackground = TextureFactory.tテクスチャの生成(pathPopupMenuBackground, false, "txPopupMenuBackground");
208237 }
209238
210- if (stqMenuTitle.txName == null)
239+ if (this.stqMenuTitle.txName != null)
211240 {
212- stqMenuTitle.txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(stqMenuTitle.cItem.label, Color.White, Color.Black), false);
213- stqMenuTitle.rectName = prvFont.RectStrings;
241+ TextureFactory.tテクスチャの解放(ref this.stqMenuTitle.txName);
214242 }
243+ stqMenuTitle.txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(stqMenuTitle.cItem.label, Color.White, Color.Black), false, "stqMenuTitle.txName");
244+ stqMenuTitle.rectName = prvFont.RectStrings;
245+
215246 for (int i = 0; i < lciMenuItems.Length; i++)
216247 {
217- lciMenuItems[i].txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(lciMenuItems[i].label, Color.White, Color.Black), false);
248+ if (lciMenuItems[i].txName != null)
249+ {
250+ TextureFactory.tテクスチャの解放(ref lciMenuItems[i].txName);
251+ }
252+ lciMenuItems[i].txName = TextureFactory.tテクスチャの生成(prvFont.DrawPrivateFont(lciMenuItems[i].label, Color.White, Color.Black), false, "lciMenuItems[i].txName");
218253 lciMenuItems[i].rectName= prvFont.RectStrings;
219254 }
220255