I am trying to make dynamic ui function.
so, I made a file with .so type to add a window component in a tabwindow.
basically, it is working well before I click the tab. It means that constructor and painting & resize function calling was working.
but, when I clicked the tab, I got segmentation fault.
then, I cut off some part in callee class to figure out where the problem happend.
// Test1_Button->setBounds (324, 196, 150, 24);
// Test2_Button->setBounds (324, 236, 150, 24);
It works.
so, it looks like that the sub component painting function makes the segmentation fault, but I can’t understand why it happend for only dynamic loading case.
do you have any idea ?
/* Caller Class */
//[Constructor] You can add your own custom stuff here..
String fileName(T("libIProperty.so"));
File ipControl(fileName);
if(ipControl.exists() == true )
{
ipControlHandle = Process::loadDynamicLibrary(fileName);
// load the symbols
createFunction = (create_t *)Process::getProcedureEntryPoint (ipControlHandle,String(T("create")));
destroyFunction = (destroy_t *)Process::getProcedureEntryPoint (ipControlHandle,String(T("destroy")));
iProperty= createFunction();
tabbedComponent->addTab (T("IP Control"), Colours::lightgrey, iProperty, true);
}
//[/Constructor]
//[Destructor_pre]. You can add your own custom destruction code here..
String fileName(T("libIProperty.so"));
File ipControl(fileName);
if(ipControl.exists() == true )
{
destroyFunction(iProperty);
Process::freeDynamicLibrary (ipControlHandle);
}
//[/Destructor_pre]
================================
/* Callee Class */
XNexus_XTE_IProperty::XNexus_XTE_IProperty ()
: Test1_Button (0),
Test2_Button (0)
{
addAndMakeVisible (Test1_Button = new TextButton (T(“Test1_Button”)));
Test1_Button->setButtonText (T(“Intelligent Property”));
Test1_Button->addButtonListener (this);
addAndMakeVisible (Test2_Button = new TextButton (T("Test2_Button")));
Test2_Button->setButtonText (T("Plug & Play Test"));
Test2_Button->addButtonListener (this);
setSize (992, 600);
}
XNexus_XTE_IProperty::~XNexus_XTE_IProperty()
{
deleteAndZero (Test1_Button);
deleteAndZero (Test2_Button);
}
void XNexus_XTE_IProperty::paint (Graphics& g)
{
g.fillAll (Colours::white);
}
void XNexus_XTE_IProperty::resized()
{
Test1_Button->setBounds (324, 196, 150, 24);
Test2_Button->setBounds (324, 236, 150, 24);
}
void XNexus_XTE_IProperty::buttonClicked (Button* buttonThatWasClicked)
{
if (buttonThatWasClicked == Test1_Button)
{
}
else if (buttonThatWasClicked == Test2_Button)
{
}
}
extern “C” XNexus_XTE_IProperty* create() {
return new XNexus_XTE_IProperty;
}
extern “C” void destroy(XNexus_XTE_IProperty* p) {
delete p;
}