[haiku-commits] haiku: hrev52326 - src/servers/app

  • From: Stefano Ceccherini <stefano.ceccherini@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 10 Sep 2018 06:55:44 -0400 (EDT)

hrev52326 adds 2 changesets to branch 'master'
old head: 7f644d106dccfa3780981e084523ac740e5b8bc0
new head: cb0d7a1ecd58559b2f6dc06ceb86a327e75f46df
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=cb0d7a1ecd58+%5E7f644d106dcc

----------------------------------------------------------------------------

d1311300dccf: app_server: local variable was shadowing the outer variable
  In the AS_CLIP_TO_PICTURE case, the "picture" variable was shadowing the 
outer "picture" variable.
  
  Change-Id: I3b9de2432f93a683aaccdb899051a14ebf9b7e6e

cb0d7a1ecd58: app_server: make a copy of the passed BPicture
  Like the AS_DRAW_PICTURE case, make a copy of the passed BPicture also for 
AS_CLIP_TO_PICTURE
  
  Change-Id: Id9a0adc48d73e5ec9c0d37e2ed85e30aa48369ab

                             [ JackBurton79 <stefano.ceccherini@xxxxxxxxx> ]

----------------------------------------------------------------------------

1 file changed, 10 insertions(+), 7 deletions(-)
src/servers/app/ServerWindow.cpp | 17 ++++++++++-------

############################################################################

Commit:      d1311300dccf3b01d5180a0264e9f715e155c479
URL:         https://git.haiku-os.org/haiku/commit/?id=d1311300dccf
Author:      JackBurton79 <stefano.ceccherini@xxxxxxxxx>
Date:        Mon Sep 10 10:45:21 2018 UTC

app_server: local variable was shadowing the outer variable
In the AS_CLIP_TO_PICTURE case, the "picture" variable was shadowing the outer 
"picture" variable.

Change-Id: I3b9de2432f93a683aaccdb899051a14ebf9b7e6e

----------------------------------------------------------------------------

diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp
index 6d4a880c67..9cc8fbbafe 100644
--- a/src/servers/app/ServerWindow.cpp
+++ b/src/servers/app/ServerWindow.cpp
@@ -3699,13 +3699,13 @@ ServerWindow::_DispatchPictureMessage(int32 code, 
BPrivate::LinkReceiver& link)
                        if (link.Read<bool>(&inverse) != B_OK)
                                break;
 
-                       ServerPicture* picture = 
fServerApp->GetPicture(pictureToken);
-                       if (picture == NULL)
+                       ServerPicture* pictureToClip = 
fServerApp->GetPicture(pictureToken);
+                       if (pictureToClip == NULL)
                                break;
 
-                       picture->WriteClipToPicture(picture->Token(), where, 
inverse);
+                       picture->WriteClipToPicture(pictureToClip->Token(), 
where, inverse);
 
-                       picture->ReleaseReference();
+                       pictureToClip->ReleaseReference();
                        break;
                }
 

############################################################################

Revision:    hrev52326
Commit:      cb0d7a1ecd58559b2f6dc06ceb86a327e75f46df
URL:         https://git.haiku-os.org/haiku/commit/?id=cb0d7a1ecd58
Author:      JackBurton79 <stefano.ceccherini@xxxxxxxxx>
Date:        Mon Sep 10 10:48:30 2018 UTC

app_server: make a copy of the passed BPicture
Like the AS_DRAW_PICTURE case, make a copy of the passed BPicture also for 
AS_CLIP_TO_PICTURE

Change-Id: Id9a0adc48d73e5ec9c0d37e2ed85e30aa48369ab

----------------------------------------------------------------------------

diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp
index 9cc8fbbafe..fbfd7454a8 100644
--- a/src/servers/app/ServerWindow.cpp
+++ b/src/servers/app/ServerWindow.cpp
@@ -3700,12 +3700,15 @@ ServerWindow::_DispatchPictureMessage(int32 code, 
BPrivate::LinkReceiver& link)
                                break;
 
                        ServerPicture* pictureToClip = 
fServerApp->GetPicture(pictureToken);
-                       if (pictureToClip == NULL)
-                               break;
-
-                       picture->WriteClipToPicture(pictureToClip->Token(), 
where, inverse);
-
-                       pictureToClip->ReleaseReference();
+                       if (pictureToClip != NULL) {
+                               // We need to make a copy of the picture, since 
it can
+                               // change after it has been drawn
+                               ServerPicture* copy = 
App()->CreatePicture(pictureToClip);
+                               picture->NestPicture(copy);
+                               picture->WriteClipToPicture(copy->Token(), 
where, inverse);
+
+                               pictureToClip->ReleaseReference();
+                       }
                        break;
                }
 


Other related posts:

  • » [haiku-commits] haiku: hrev52326 - src/servers/app - Stefano Ceccherini