CR.42 was certainly obsolete already before the war started but unfortunately for Italian fighter pilots, it most certainly was "on its way out". Cr.42 was still in production when C.200 production ceased.
Production for what means? Not for Italian Air Force needs, that's for sure. It was being exported. As you mention Hungary used it. Other nations did too. Ones that could or did not build their own air forces. Those being produced were being exported and the plane was not a frontline fighter.
When the war started in 1939 Italy had about 250 of the biplanes in service. They had some raids into Southern France. They moved about 50 planes to Belgium to help with the BOB but they were there only 3-4 months, suffered large casualties, and claimed serious over-exaggerated victories.
They helped the war in N. Africa until Hurricanes showed up and they were relegated to ground strafing duties. This as early as 1941, mind you. As early as spring 1941 they were being transitioned to ground attack duties and monoplanes were replacing them as quickly as possible. Throughout 1941 they continued to transition. After the battle of El Alamein only 82 were left to retreat back to Italy (spring of 1942).
In 1940 over Greece they had some success against far worse airframes, but as soon as the RAF showed up with Gladiators and later on Hurricanes, the tables turned significantly.
In East Africa a small group held out until late 1941 but were finished off by November of that year.
After 1941 they were not sent into combat as fighters. They were relegated to rear action duties, troop strafing, dropping very small bombs in anti personnel duties, etc.
They were as obsolete as the Stuka. Mind you the Stuka served on after it was withdrawn from front-line duties in BOB as well. It was never sent into the front line action again, though. The same goes for the Cr42.
Calling it a frontline fighter is like calling the Lysander a frontline attack plane for the RAF.