[haiku-commits] Re: haiku: hrev51662 - src/apps/stylededit

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 11 Dec 2017 08:59:49 +0100

Am 08/12/2017 um 15:09 schrieb (Redacted sender janus2 for DMARC):

+bool
+ReplaceWindow::QuitRequested()
+{
+       BMessenger messenger(fHandler);
+       messenger.SendMessage(MSG_REPLACE_WINDOW_QUIT);
[...]
+               case MSG_REPLACE_WINDOW_QUIT:
+               {
+                       fReplaceWindow = NULL;
+                       break;
+               }

Just note that this leaves a race condition where fReplaceWindow may already have been deleted before the message arrives.

A safer method would be to delete the window in the handler only.

However, if you wanted to return false from QuitRequested(), be noted that this would eventually prevent Haiku from shutting down. Hmm... sounds like the API could use some cleanup here :-)

Bye,
   Axel.

Other related posts: