2017-12-16 15 views
0

私はProjucer(Juce v5.2.0)とxCode 9.2を使用していますが、SliderでsetLookAndFeelを使用するといくつかの奇妙なエラーが発生します。Juce - setLookAndFeel - エラー

私はそのチュートリアルで一歩一歩を行く: https://www.youtube.com/watch?v=po46y8UKPOY&t=1020s

と私は正確に同じコードを作ります。ビデオで問題はありません。同じコードを17:13のムービーの中にコンパイルすると、私のエラーが表示されます。

私の問題は、コードをすべてコンパイルすると問題はありません。コンパイルされたアプリケーションはうまく動作し、 "setLookAndFeel"は期待通りに動作します。しかし、問題は私がアプリケーションを閉じるときです。アプリは閉じたように見えますが、アイコンはドックにあり、xCodeは「停止」ボタンがアクティブであることを示していますので、アプリは何らかの形で動作しているようです。そして、Xcodeは、「(1)Juceマッサージスレッド」と呼ばれるものに自動的に私を取り、エラーがあります: Juce Message Thread (1): EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0

それはそのコードの隣にあります:

jassert (masterReference.getNumActiveWeakReferences() == 0 
      || (masterReference.getNumActiveWeakReferences() == 1 
       && this == &getDefaultLookAndFeel())); 

誰も私を助けてもらえますか? ありがとうございます。

答えて

0

あなたは、あなたがそれをヒットしている理由を説明ヒットしましたアサーション上記大型コメントブロックがあります:

/* This assertion is triggered if you try to delete a LookAndFeel object while something 
    is still using it! 

    Reasons may be: 
    - it's still being used as the default LookAndFeel; or 
    - it's set as a Component's current lookandfeel; or 
    - there's a WeakReference to it somewhere else in your code 

    Generally the fix for this will be to make sure you call 
    Component::setLookandFeel (nullptr) on any components that were still using 
    it before you delete it, or call LookAndFeel::setDefaultLookAndFeel (nullptr) 
    if you had set it up to be the default one. This assertion can also be avoided by 
    declaring your LookAndFeel object before any of the Components that use it as 
    the LookAndFeel will be destroyed before the Components. 

    Deleting a LookAndFeel is unlikely to cause a crash since most things will use a 
    safe WeakReference to it, but it could cause some unexpected graphical behaviour, 
    so it's advisable to clear up any references before destroying them! 
*/ 

だから、あなたは、おそらくのデストラクタで、それが削除される前に、スライダ上setLookAndFeel (nullptr)を呼び出す必要がありますその親コン​​ポーネント

+0

ありがとう、それは私を助けました。 – pajczur

関連する問題