Tuesday, May 12, 2009

Another lesson learned

8 hours brain frying debugging finally solved a crashed bug. yes it's a single bug reported in Bugzilla, but it's actually contributed by many sources.
  1. Singleton object, one of the third party library use singleton and my application is multithreaded, so they were on fire. lesson learned: singleton is bad
  2. Smart pointer, another third party uses smart pointer to manage memory, therefore depends on state it might help me clean up my memory :). lesson learned: raw pointer isn;t that difficult then the behavior is better understood so use more raw pointer
  3. Unreset windows event, if a event was created with manual reset attribute, the state will stay set until it is manually resetted, this make your program only work correctly at the first time
  4. thread id, GetThreadId() is only available on window vista and 64bit xp. on xp stored the id yourself. and the question is where to get the id? if you used _beginthread or _beginthreadex, it is the thrdadd parameter
  5. WM_USER event doesn't dispatch by DispatchMessage(), the reason still a big mistery, hopefully i could find out soon
  6. if you got interlocking problem while you delete child window with DestroyWindow(), try set exstyle to WS_EX_NOPARENTNOTIFY when you create child window, this could prevent the interlocking. (more testing needed)
  7. the infamous, interface class no virtual destructor problem, see my previous post
  8. and many more careless mistakes that do not worth to mention here
But the problem still not fully solved yet, such as keyboard input become not responsive if multiple instances exist. and closes multiple instances at once may still cause the crash. I guess QA still need to curse and swear me for some time :)

No comments: