COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 01-07-2019, 07:49 AM   #1
jan hase
Human being with feelings
 
Join Date: Jul 2017
Posts: 25
Default IPlug2 Issue: ProcessBlock runs before mlayoutFunc

hey there,

it seems that the ProceesBlock function is called before mLayoutFunc causing pointers which are declared in IPLugEffect.h and assigned and attached in mLayoutFunc to be empty, when ProcessBlock gets called, which results in: Exception thrown: read access violation.
this->TextToChange was 0xFFFFFFFFFFFFFFFF.

is this a bug, or is IPlug2 supposed to be used differently in this than Iplug1?


to replicate issue:

Code:
//in IplugEffect.h in public: add:

ITextControl *TextToChange; 



//in IplugEffect.cpp add:

//in mLayoutFunc:

TextToChange = new ITextControl(*this, b.GetFromTop(50), "TestText", IText(50));
   pGraphics->AttachControl(TextToChange);


//in ProcessBlock:

TextToChange->SetStr("it works");
jan hase is offline   Reply With Quote
Old 09-28-2019, 09:17 AM   #2
TBProAudio
Human being with feelings
 
TBProAudio's Avatar
 
Join Date: May 2014
Location: Germany
Posts: 507
Default

Quote:
Originally Posted by jan hase View Post
hey there,

it seems that the ProceesBlock function is called before mLayoutFunc causing pointers which are declared in IPLugEffect.h and assigned and attached in mLayoutFunc to be empty, when ProcessBlock gets called, which results in: Exception thrown: read access violation.
this->TextToChange was 0xFFFFFFFFFFFFFFFF.

is this a bug, or is IPlug2 supposed to be used differently in this than Iplug1?


to replicate issue:

Code:
//in IplugEffect.h in public: add:

ITextControl *TextToChange; 



//in IplugEffect.cpp add:

//in mLayoutFunc:

TextToChange = new ITextControl(*this, b.GetFromTop(50), "TestText", IText(50));
   pGraphics->AttachControl(TextToChange);


//in ProcessBlock:

TextToChange->SetStr("it works");

I hope you solved it already:-) In any case here is the solution:


IPLUG2:


Quote:
enum ECtrlTags
{
kCtrlTagText,
};
Quote:
pGraphics->AttachControl(TextToChange, kCtrlTagText);
...and finally:
Quote:
if (GetUI()->GetControlWithTag(kCtrlTagText)) // Always check if control is available
{
ITextControl* pITextControl = dynamic_cast<ITextControl*>(GetUI()->GetControlWithTag(kCtrlTagText));
pITextControl->SetStr("test");
}
__________________
www.tb-software.com/TBProAudio
TBProAudio is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:46 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.