Merge lp:~compiz-team/compiz/compiz.fix_1015151 into lp:compiz/0.9.8

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1015151
Merge into: lp:compiz/0.9.8
Diff against target: 0 lines
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1015151
Reviewer Review Type Date Requested Status
Daniel van Vugt Pending
Review via email: mp+111140@code.launchpad.net

This proposal supersedes a proposal from 2012-06-19.

This proposal has been superseded by a proposal from 2012-06-20.

Description of the change

== Problem ==

Crash in compiz::wall::movementWindowOnScreen (const CompRect &serverBorderRect, const CompRegion &screenRegion) because we were iterating a temporary CompRect::vector which went out of scope within the for statement.

(LP: #1015151)

== Solution ==

Copy the vector, then iterate it.

== Test ==

Covered already, but this wasn't caught by the testsuite as I had to use valgrind to find the memory error. we should run tests under valgrind in CI to catch these ones in future.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Diff, since bzr push :parent bugged out and pushed to lp:compiz (reverted in r3252)

=== modified file 'plugins/wall/src/offset_movement/src/offset-movement.cpp'
--- plugins/wall/src/offset_movement/src/offset-movement.cpp 2012-06-19 23:36:57 +0000
+++ plugins/wall/src/offset_movement/src/offset-movement.cpp 2012-06-19 23:42:45 +0000
@@ -28,7 +28,7 @@
 compiz::wall::movementWindowOnScreen (const CompRect &serverBorderRect,
           const CompRegion &screenRegion)
 {
- CompRegion sbrRegion (serverBorderRect);
+ CompRegion sbrRegion (static_cast <const CompRect &> (serverBorderRect));

     /* If the window would be partially offscreen
      * after it was moved then we should move it back
@@ -41,10 +41,8 @@
     int dx = 0;
     int dy = 0;

- CompRect::vector rects (rem.rects ());
-
- for (std::vector <CompRect>::const_iterator it = rects.begin ();
- it != rects.end ();
+ for (std::vector <CompRect>::const_iterator it = rem.rects ().begin ();
+ it != rem.rects ().end ();
   it++)
     {
  const CompRect &r = *it;

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Correction:

=== modified file 'plugins/wall/src/offset_movement/src/offset-movement.cpp'
--- plugins/wall/src/offset_movement/src/offset-movement.cpp 2012-06-19 23:42:45 +0000
+++ plugins/wall/src/offset_movement/src/offset-movement.cpp 2012-06-19 23:35:09 +0000
@@ -28,7 +28,7 @@
 compiz::wall::movementWindowOnScreen (const CompRect &serverBorderRect,
           const CompRegion &screenRegion)
 {
- CompRegion sbrRegion (static_cast <const CompRect &> (serverBorderRect));
+ CompRegion sbrRegion (serverBorderRect);

     /* If the window would be partially offscreen
      * after it was moved then we should move it back
@@ -41,8 +41,10 @@
     int dx = 0;
     int dy = 0;

- for (std::vector <CompRect>::const_iterator it = rem.rects ().begin ();
- it != rem.rects ().end ();
+ CompRect::vector rects (rem.rects ());
+
+ for (std::vector <CompRect>::const_iterator it = rects.begin ();
+ it != rects.end ();
   it++)
     {
  const CompRect &r = *it;

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Empty diff?!

review: Needs Resubmitting
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Thanks to a launchpad bug, the diff is going to be empty anyways. You'll need to look at the revision history.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please try resubmitting from a different branch name. That might work around the launchpad issue.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

It wont. The problem is the revisions themselves.

Sent from Samsung Mobile

 Daniel van Vugt <email address hidden> wrote:

Please try resubmitting from a different branch name. That might work around the launchpad issue.
--
https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1015151/+merge/111140
Your team Compiz Maintainers is subscribed to branch lp:compiz.

Unmerged revisions

Preview Diff

Empty

Subscribers

People subscribed via source and target branches