Custom Component mouse enter error


#1

Hi, I’ve setting up my FL Studio SDK and Juce to make work and encountered some problems with creating editor. I successfully created blank,black editor window that FL Studio host can display, but when I just move mouse over the window, an access violation error message is shown, and FL crashes. What seems to be wrong? Maybe i need to implement some very important virtual methods. Generally I make a constructor of my class (derived from Component class) and that’s all. Any suggestions? thanks in advance for help.


#2

Starting from the exmple plug-in is a great way to get you started.
Did you try it? it’s located in ‘juce/extras/audio plugins’


#3

Thanks for quick response. I’ll check this example.


#4

I’ve done everything as it is in example project. And still when I move mouse over my form it crashes. Also when i used jucer to create plugin with FL Studio SDK, it makes the same situation.


#5

So debug it.

If you just say “my app crashes”, and you haven’t even bothered to use your debugger to try to see what’s happening, then I’m afraid you’re not going to get much sympathy on this forum!


#6

You are right… i’ll try to debug this somehow. When I get more info i’ll back then.


#7

Ok, the problem solved :slight_smile: I must setup the LookAndFeel of the editor and a valid cursor, thanks jules, debugging helps me a lot :slight_smile:


#8

There’s no need to set a lookandfeel or cursor explicitly… Where was it crashing?


#9

It was crashing in the assertion (assertion that lookandfeel field is null) in file of lookandfeel class. Sorry for my not detailed explanations but in c++ I have not much experience.


#10

Ok. An assertion is not a crash.

And I can’t find any such assertion in the lookandfeel class… I guess you’re using the last release version, and the code has probably changed since then.


#11

Ok. I have one small question that will help me a bit: how I can turn DBG to not print on the screen but in a file that i specify? I asking becuse FL Studio blocks (probably) any console output (when I’m trying to run by cmd console).


#12

Ok i see now what DBG says:

[quote]*** Leaked objects detected: 1 instance(s) of class class juce::InternalTimerThread
FL.exe has triggered a breakpoint
The program ‘[7708] FL.exe: Native’ has exited with code 0 (0x0).[/quote]

It appears directly after exitting this method due to I’m closing plugin in FL Studio:

[code]void _stdcall CFruityDFR::DestroyObject()
{
EditorForm->removeFromDesktop();
delete EditorForm;

TCPPFruityPlug::DestroyObject();   // don't forget this

}[/code]

The EditorForm derives from Component class.

This is probbably the last issue with this plugin… and i will be able to start coding the main plugin logic.


#13

No idea what that code’s supposed to do, but you’ve caused a leak somewhere.


#14

Ups, i break to early and mislook that the leak was bigger. For me it seems to be an situation where is nedeed to remove editor component manually. Full leak is:

*** Leaked objects detected: 1 instance(s) of class class juce::InternalTimerThread
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::Thread
FL.exe has triggered a breakpoint
*** Leaked objects detected: 2 instance(s) of class class juce::WaitableEvent
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::OwnedArray<class juce::ModalComponentManager::ModalItem,class juce::DummyCriticalSection>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::HeapBlock<class juce::ModalComponentManager::ModalItem *>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::MouseInputSource
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::Desktop
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::ComponentAnimator
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::OwnedArray<class juce::ComponentAnimator::AnimationTask,class juce::DummyCriticalSection>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::HeapBlock<class juce::ComponentAnimator::AnimationTask *>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::HeapBlock<class juce::ChangeListener *>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 2 instance(s) of class class juce::HeapBlock<class juce::Rectangle<int> >
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::HeapBlock<class juce::FocusChangeListener *>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::HeapBlock<class juce::MouseListener *>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::OwnedArray<class juce::MouseInputSource,class juce::DummyCriticalSection>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::HeapBlock<class juce::MouseInputSource *>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 5 instance(s) of class class juce::CallbackMessage
FL.exe has triggered a breakpoint
*** Leaked objects detected: 6 instance(s) of class class juce::Message
FL.exe has triggered a breakpoint
*** Leaked objects detected: 5 instance(s) of class class juce::AsyncUpdater
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::MessageManager
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::HeapBlock<class juce::MessageListener const *>
FL.exe has triggered a breakpoint
*** Leaked objects detected: 1 instance(s) of class class juce::HeapBlock<class juce::Component *>
FL.exe has triggered a breakpoint
First-chance exception at 0x57585fdf (FruityDFR.dll) in FL.exe: 0xC0000005: Access violation reading location 0x0483f698.

#15

You’re clearly hacking something in a non-standard way, so I can’t really help you track it down. All I can say that may be helpful is that you don’t seem to be shutting down juce correctly. If shutdownJuce_GUI() wasn’t getting called, then you’d see all those leaked objects.


#16

…or actually, you might just be leaking a plugin object, which could also lead to the library not getting shutdown.


#17

One thing that i don’t do is creating JUCEApplication (Should I definitely create it?). Is it possible to register component manually? because shutdownJUCE_Gui() doesn’t work.
I’ve pasted some code of my plugin:
http://pastebin.com/EcQYuUnq
http://pastebin.com/K5R7jstW


#18

I really don’t have time to look through your code - if you’re writing a plugin, just do it like the demo and all of this stuff gets taken care of. If you’re going to go off-piste, you’re on your own, I’m afraid!