back

by rramadass·6y ago·view on hn ↗
Windows 3.1 16-bit multi-functional modules app i.e. skeleton app which loaded multiple DLLs one for each type of functionality. When printing on a dot-matrix printer everything would work fine. However when printing on a (then new) Laser printer the entire system would hang randomly. Didn't matter which module was the initiator. Spent 2 weeks poring over the code in our common DLL used for printing and found nothing. Then started checking rest of the code in each module and found it. Each module called into the common "print dll" to print its graphs. On return back it would call a local function to print the "graph legends" and thats where the problem was. The last line of this function called "ReleaseDC" but the parameters "hWnd" and "hDC" were switched by mistake so Windows released some unexpected memory giving rise to the problem. This code was cut and pasted into each module with minor modifications and therefore existed in all the functional modules.

I was somewhat proud of solving this :-)