* Do the locking and lock check in an outer 'if', the window could be left
unlocked if the whole condition wasn't true. Thanks stippi! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28276 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -258,41 +258,43 @@ TTracker::QuitRequested()
|
|||||||
BContainerWindow *window = dynamic_cast<BContainerWindow *>
|
BContainerWindow *window = dynamic_cast<BContainerWindow *>
|
||||||
(fWindowList.ItemAt(i));
|
(fWindowList.ItemAt(i));
|
||||||
|
|
||||||
if (window && window->Lock() && window->TargetModel()
|
if (window && window->Lock()) {
|
||||||
&& !window->PoseView()->IsDesktopWindow()) {
|
if (window->TargetModel()
|
||||||
if (window->TargetModel()->IsRoot())
|
&& !window->PoseView()->IsDesktopWindow()) {
|
||||||
message.AddBool("open_disks_window", true);
|
if (window->TargetModel()->IsRoot())
|
||||||
else {
|
message.AddBool("open_disks_window", true);
|
||||||
BEntry entry;
|
else {
|
||||||
BPath path;
|
BEntry entry;
|
||||||
const entry_ref *ref = window->TargetModel()->EntryRef();
|
BPath path;
|
||||||
if (entry.SetTo(ref) == B_OK && entry.GetPath(&path) == B_OK) {
|
const entry_ref *ref = window->TargetModel()->EntryRef();
|
||||||
int8 flags = window->IsMinimized() ? kOpenWindowMinimized : kOpenWindowNoFlags;
|
if (entry.SetTo(ref) == B_OK && entry.GetPath(&path) == B_OK) {
|
||||||
uint32 deviceFlags = GetVolumeFlags(window->TargetModel());
|
int8 flags = window->IsMinimized() ? kOpenWindowMinimized : kOpenWindowNoFlags;
|
||||||
|
uint32 deviceFlags = GetVolumeFlags(window->TargetModel());
|
||||||
|
|
||||||
// save state for every window which is
|
// save state for every window which is
|
||||||
// a) already open on another workspace
|
// a) already open on another workspace
|
||||||
// b) on a volume not capable of writing attributes
|
// b) on a volume not capable of writing attributes
|
||||||
if (window != FindContainerWindow(ref)
|
if (window != FindContainerWindow(ref)
|
||||||
|| (deviceFlags & (B_FS_HAS_ATTR | B_FS_IS_READONLY)) != B_FS_HAS_ATTR) {
|
|| (deviceFlags & (B_FS_HAS_ATTR | B_FS_IS_READONLY)) != B_FS_HAS_ATTR) {
|
||||||
BMessage stateMessage;
|
BMessage stateMessage;
|
||||||
window->SaveState(stateMessage);
|
window->SaveState(stateMessage);
|
||||||
window->SetSaveStateEnabled(false);
|
window->SetSaveStateEnabled(false);
|
||||||
// This is to prevent its state to be saved to the node when closed.
|
// This is to prevent its state to be saved to the node when closed.
|
||||||
message.AddMessage("window state", &stateMessage);
|
message.AddMessage("window state", &stateMessage);
|
||||||
flags |= kOpenWindowHasState;
|
flags |= kOpenWindowHasState;
|
||||||
}
|
|
||||||
const char *target;
|
|
||||||
bool pathAlreadyExists = false;
|
|
||||||
for (int32 index = 0;message.FindString("paths", index, &target) == B_OK;index++) {
|
|
||||||
if (!strcmp(target,path.Path())) {
|
|
||||||
pathAlreadyExists = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
const char *target;
|
||||||
|
bool pathAlreadyExists = false;
|
||||||
|
for (int32 index = 0;message.FindString("paths", index, &target) == B_OK;index++) {
|
||||||
|
if (!strcmp(target,path.Path())) {
|
||||||
|
pathAlreadyExists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!pathAlreadyExists)
|
||||||
|
message.AddString("paths", path.Path());
|
||||||
|
message.AddInt8(path.Path(), flags);
|
||||||
}
|
}
|
||||||
if (!pathAlreadyExists)
|
|
||||||
message.AddString("paths", path.Path());
|
|
||||||
message.AddInt8(path.Path(), flags);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window->Unlock();
|
window->Unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user