Merge lp://qastaging/~fhd/unity-2d/fix-for-bug-6600100 into lp://qastaging/unity-2d

Proposed by Felix H. Dahlke
Status: Superseded
Proposed branch: lp://qastaging/~fhd/unity-2d/fix-for-bug-6600100
Merge into: lp://qastaging/unity-2d
Diff against target: 152 lines (+73/-20)
2 files modified
libunity-2d-private/src/launcherdevice.cpp (+69/-20)
libunity-2d-private/src/launcherdevice.h (+4/-0)
To merge this branch: bzr merge lp://qastaging/~fhd/unity-2d/fix-for-bug-6600100
Reviewer Review Type Date Requested Status
Marco Biscaro (community) Needs Fixing
unity-2d-team Pending
Review via email: mp+70207@code.qastaging.launchpad.net

This proposal has been superseded by a proposal from 2011-08-03.

Description of the change

Added a "safely remove" option for USB sticks to the launcher.

To post a comment you must log in.
Revision history for this message
Marco Biscaro (marcobiscaro2112) wrote :

16 + if (g_mount_can_unmount(mount)) {
17 + g_mount_unmount_with_operation(mount, G_MOUNT_UNMOUNT_NONE, mountOperation, NULL,
18 + (GAsyncReadyCallback) LauncherDevice::onMountUnmounted,
19 + NULL);
20 + } else {
21 + g_object_unref(mount);
22 + }

The GMount object always need to be unref-ed, not only when if fails to unmount. The code should be something like:

if (mount) {
  if (g_mount_can_unmount(mount)) {
    g_mount_unmount_with_operation(mount, G_MOUNT_UNMOUNT_NONE, mountOperation, NULL,
                                   (GAsyncReadyCallback) LauncherDevice::onMountUnmounted,
                                   NULL);
  }
  g_object_unref(mount);
}

82 + g_object_unref(drive);

If, for some weird reason, drive is null, we can get in trouble. I think you need to check if this variable is set before trying to unref it.

review: Needs Fixing
631. By Felix H. Dahlke

Added a missing unref and null pointer check.

632. By Felix H. Dahlke

Added a null pointer check.

633. By Felix H. Dahlke

Used smart pointers instead of regular ones.

634. By Felix H. Dahlke

Only showing the "safely remove" option if the drive can be stopped.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches