TabCycle causing lockup on OS4

This forum is for general developer support questions.
Post Reply
User avatar
ktadd
Posts: 48
Joined: Wed Nov 09, 2011 5:50 am

TabCycle causing lockup on OS4

Post by ktadd »

I have a program where I have two string gadgets created with the GA_TabCycle flag set to TRUE. These gadgets also call a custome hook so I can control the format. When the gadget are activated the hook is called and all works well. When I return from the hook to the event loop I also capture the
event for the gadget so I can check the entry of the second string gadget against the first one. If the entry is invalid I use the ActivateGadget call to re-activate the second gadget with the invalid entry so the user can correct it. If while editing the second gadget value I then press Shift-TAB to go back to the first gadet the system lockes up. The CPU monitor freezes and I don't get any response from the keyboard or mouse.

If I remove the ActivateGadget call I can TAB and SHIF TAB between the gadgets all day long with no problems. If I set the GA_TabCycle flag to FALSE for the gadgets I of course can't use TAB to change gadgets but using ActivateGadget to switch between the two works fine. Is this an OS bug or am I
perhapse doing something invalid?

I'm using a uA1 with OS4 Update 4 with the lastest public SDK. Any ideas?
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: TabCycle causing lockup on OS4

Post by tonyw »

As it used to say in Impossible Mission... "Need more pieces".

When you say "lockup", you presumably mean a complete freeze of the system, no crash or crash log?
Do you have the Clock docky in AmiDock? I always find that a good indication of system activity. You can also run "ping" with output to "SER:" and observe it still running on a remote machine.

I'm on this track because it sounds like an Intuition deadlock. There are many possible causes, and I think I've seen them all in the console. They are usually caused by trying to redraw something in the window while a Lock is held on the layout by Layers.library.

Does it only lock up if there is an invalid entry? Could it be caused by your processing of the invalid entry? Have you tried disabling parts of te processing to see if you can narrow down the part that causes it?

There are plenty of applications using two string gadgets, eg "Replace" in Notepad or Codepad, most of the gadgets in RawDisk. They don't show this problem.
cheers
tony
User avatar
ktadd
Posts: 48
Joined: Wed Nov 09, 2011 5:50 am

Re: TabCycle causing lockup on OS4

Post by ktadd »

I found the cause of the freeze. I used the clock docky to verify the system was frozen, although I could reboot using the soft and hard reboot key combinations. Those are the only input responded to. I eliminated the hooks and tried a few things to no avail. Then I looked at the OS4 "string" gadget example code which has two string and a button gadget. I noticed in the code they were using a differnt function call to activate the gadget than I was. I then modifed the example code to activate the gadgets with the call I was using and the freezed occured just as in my program.

Here is what I discovered. I was using the following to activate my gadget:
IIntuition->ActivateGadget(gadgets[GID_END_TIME], windows[OID_MAIN], NULL);

When I changed it to the following my program work find with tabbing.
ILayout->ActivateLayoutGadget( gadgets[GID_MAIN], windows[OID_MAIN], NULL, (ULONG)gadgets[GID_END_TIME] );

Not sure why using ActivateGadget causes a problem. If you want me to send you the modified example code just let me know and give me a place to send it.

Thank!
Kevin - X1000 first contact / uA1
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: TabCycle causing lockup on OS4

Post by tonyw »

Yes, just reading the docs for those two functions shows that they are pretty critical as to the environment in which they are called.

Good thing you found a work-around for it.
cheers
tony
User avatar
turbo4.1
Posts: 18
Joined: Sat Jul 02, 2011 12:14 pm

Re: TabCycle causing lockup on OS4

Post by turbo4.1 »

@ktadd
thank you for tipp. i have a similar problem in atual project!
i will change my code and look what's happend!
Amiga user since 1987
Sam440Flex 666Mhz, Radeon 9250, 1GB RAM
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: TabCycle causing lockup on OS4

Post by trixie »

@ktadd
ktadd wrote: Here is what I discovered. I was using the following to activate my gadget:
IIntuition->ActivateGadget(gadgets[GID_END_TIME], windows[OID_MAIN], NULL);

When I changed it to the following my program work find with tabbing.
ILayout->ActivateLayoutGadget( gadgets[GID_MAIN], windows[OID_MAIN], NULL, (ULONG)gadgets[GID_END_TIME] );
Out of curiosity, what happens if you activate the string not by calling ActivateGadget() / ActivateLayoutGadget() but by sending the GM_GOACTIVE method to the gadget? DoGadgetMethod() or IDoMethod() should do the trick; unfortunately I cannot test that for you as my Sam is defunct at the moment :-(
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: TabCycle causing lockup on OS4

Post by ssolie »

trixie wrote:I cannot test that for you as my Sam is defunct at the moment :-(
Sorry, I'm still working on that. I'll send you an email tonight.
ExecSG Team Lead
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: TabCycle causing lockup on OS4

Post by trixie »

ssolie wrote:
trixie wrote:I cannot test that for you as my Sam is defunct at the moment :-(
Sorry, I'm still working on that. I'll send you an email tonight.
Steven, you know that comment was never ever meant as the slightest complaint, let alone one concerning you! I really appreciate the way you stepped in to deal with my unfortunate situation.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
ktadd
Posts: 48
Joined: Wed Nov 09, 2011 5:50 am

Re: TabCycle causing lockup on OS4

Post by ktadd »

Out of curiosity, what happens if you activate the string not by calling ActivateGadget() / ActivateLayoutGadget() but by sending the GM_GOACTIVE method to the gadget? DoGadgetMethod() or IDoMethod() should do the trick;
Well, I took the string gadget example and replaced: (which activates GID_STRING2 gadget)

ILayout->ActivateLayoutGadget( gadgets[GID_MAIN], windows[WID_MAIN], NULL, (ULONG)gadgets[GID_STRING2] );
with
IIntuition->DoGadgetMethod(gadgets[GID_STRING2], windows[OID_MAIN], NULL, GM_GOACTIVE, TAG_END);

Now the program doesn't activate the GID_STRING2 gadget at all.
Maybe the gadgets have to be originally setup with the Boopsi methods for this to work?
Kevin - X1000 first contact / uA1
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: TabCycle causing lockup on OS4

Post by trixie »

@ktadd

Hm, apparently the standard Intuition activation didn't work for ClassAct/ReAction gadgets when they were in a layout-controlled window, so the authors of the toolkit had to invent ILayout->ActivateLayoutGadget(). (There are more such workarounds in ReAction, the most notable being the different input event handling.) Somehow I thought the activation would have been fixed in Intuition by now but apparently it hasn't. From today's perspective, having two different, context-dependent functions to do the same thing just doesn't cut the mustard, and only contributes to the developer confusion that still surrounds ReAction.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Post Reply