LyleHaze wrote:Belxjander wrote:tonyw wrote:What do you mean by "fails to operate"? Does it crash? Or does it simply exit without doing anything?
A couple of things that stand out:
1. You haven't tested the success of any of the Interface opens. If you proceed to handle events with null interface pointers, it's going to crash.
see the "InitCommodity()" and "InitRegistration()" function contents at the bottom...
the Assumption that I don't test any of the Interface pointers is of itself a bit premature here...
I checked InitCommodity, and found the following code:
Code: Select all
if((Self->CxBase!=NULL)&&(Self->ICX!=NULL))
{
Self->cxHandle=Self->ICX->CxBroker(&dcxinit,&error);
if(Self->cxHandle!=NULL)
{
Self->ICX->ActivateCxObj(Self->cxHandle, active);
}
}
return;
So what happens if Self->ICX is NULL??
You will never call ActivateCXObj, and never alert the user that it was not called.
This would give a result of failing without warning or reason, leaving the user completely uninformed as to why it doesn't work.
As I recall, that is exactly the problem you are asking for help with.
MOST of other interface pointers you are "maybe initializing", (IUtility, ILocale, IDataTypes, and IApplication) are not checked
for a valid return anywhere in the code you provided.
However, IDOS _IS_ being used without any check to verify that it is non_Null.. in your call to CreateNewProcTags().
If your open of DOS library or GetInterface fail for any reason, your code will crash and burn at this point.
This makes a good explanation of why MOST programmers check for valid results of opens before proceeding, instead of
testing them later at each usage, like was done with your CxBroker call. And it might be helpful to actually inform the user
of why an open failed, or at least IF there was a failure, instead of just "skipping over" those calls that don't have a valid
resource available.
Belxjander wrote:
I had the impression that AmigaOS developers were not needing to be "spoonfed" all the details and would actively look around a bit more...
You might get better advice here if you try to avoid insulting those who have taken the time to help you.
Tony's advice is right on target, your comment shows a problem with your attitude.[/quote]
Well, my "attitude" is based on being ignored when I am being "nice",
Being blunt seems to be the only time I get any response at all.
as for the "advice", I have had too many "well intentioned" individuals "advise" me to in effect "f*** off", online and offline.
Thank you for pointing out that I had missed a check, I've now fixed that and will be pushing that up to the repo along with a few other changes.
the current scheme of testing is not the first iteration (where everything was attempted regardless) and the testing for "if(x)" that has been put in has made no apparent change at all.