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

  • From: "Janus" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "janus2" for DMARC)
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 11 Dec 2017 14:44:02 +0100

I just copied the code from the FIND_WINDOW…

This code is awful and if the user close the window with cancel and then reopen 
the window he will find the content…
if he closes with the titlebar button the content is lost.

I just fixed the crash i think the find and replace UI can be largely improve.

Bye J 

Il giorno 11 dic 2017, alle ore 08:59, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> 
ha scritto:

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 :-)


Other related posts: