[haiku-commits] Re: haiku: hrev48106 - in src/apps/debugger: user_interface/gui/team_window source_language

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 26 Oct 2014 21:54:00 +0100

Hi Rene,

nice changes!

Am 26.10.2014 um 21:27 schrieb anevilyak@xxxxxxxxx:
+       if (fExpressionWindow != NULL) {
+               BMessenger messenger(fExpressionWindow);
+               if (messenger.LockTarget())
+                       fExpressionWindow->Quit();
+       }

You can call Lock() on an invalid BLooper pointer, since it will look up its pointer in the global looper list before doing anything. This is essentially what BMessenger does as well, to see if its target is valid. So the code could be simply:

> +  if (fExpressionWindow != NULL && fExpressionWindow->Lock())
> +          fExpressionWindow->Quit();

I guess even the NULL check could be skipped, but I would leave it in there to not confuse anyone and for the speed of course. ;-)

Best regards,
-Stephan


Other related posts: