[haiku-commits] Re: haiku: hrev53776 - src/apps/deskcalc

  • From: Jérôme Duval <jerome.duval@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 26 Jan 2020 10:13:16 +0100

Le sam. 25 janv. 2020 à 22:53, Adrien Destugues <pulkomandy@xxxxxxxxx> a
écrit :

hrev53776 adds 1 changeset to branch 'master'
diff --git a/src/apps/deskcalc/CalcView.cpp
b/src/apps/deskcalc/CalcView.cpp
index a2d3224018..a845ccf100 100644
--- a/src/apps/deskcalc/CalcView.cpp
+++ b/src/apps/deskcalc/CalcView.cpp
@@ -802,19 +802,23 @@ void
 CalcView::Copy()
 {
        // access system clipboard
-       if (be_clipboard->Lock()) {
-               BMessage* clipper;
-               if (be_clipboard->Clear() == B_OK
-                       && (clipper = be_clipboard->Data()) == B_OK) {
-                       BString expression = fExpressionTextView->Text();
-                       if (clipper->AddData("text/plain", B_MIME_TYPE,
-                               expression.String(), expression.Length())
== B_OK) {
-                               clipper->what = B_MIME_DATA;
-                               be_clipboard->Commit();
-                       }
-               }
-               be_clipboard->Unlock();
+       if (!be_clipboard->Lock())
+               return;
+       if (be_clipboard->Clear() != B_OK)
+               return;
+
+       BMessage* clipper;
+       clipper = be_clipboard->Data();
+       if (clipper == NULL)
+               return;


The logic is not the same. be_clipboard->Unlock() isn't called anymore for
the second and third return statements.

Bye,
Jérôme

Other related posts: