Fixed live query notification for new files being created. It seems using Inode::GetName() in the middle of a transaction is not a good idea.
Axel, can you check if we really need to keep the old code there as it is now or if we can completelly remove it? I think we can but maybe there is some case I did not consider. // We have to special-case the name attribute here because // Inode::Getname will return NULL as we are in the middle // of the transaction at this point when a new file is // created. We just use newKey which happens to contain // the new file name anyway. // // TODO: Check if there is any sense in leaving this if // statement as it is or if we can completelly remove the // original code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18909 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1600,10 +1600,26 @@ Query::LiveUpdate(Inode *inode, const char *attribute, int32 type, const uint8 *
|
|||||||
char nameBuffer[B_FILE_NAME_LENGTH];
|
char nameBuffer[B_FILE_NAME_LENGTH];
|
||||||
|
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
|
|
||||||
|
// We have to special-case the name attribute here because
|
||||||
|
// Inode::Getname will return NULL as we are in the middle
|
||||||
|
// of the transaction at this point when a new file is
|
||||||
|
// created. We just use newKey which happens to contain
|
||||||
|
// the new file name anyway.
|
||||||
|
//
|
||||||
|
// TODO: Check if there is any sense in leaving this if
|
||||||
|
// statement as it is or if we can completelly remove the
|
||||||
|
// original code.
|
||||||
|
if (strcmp(attribute, "name") == 0) {
|
||||||
|
name = (const char *)newKey;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (inode->GetName(nameBuffer) != B_OK)
|
if (inode->GetName(nameBuffer) != B_OK)
|
||||||
nameBuffer[0] = '\0';
|
nameBuffer[0] = '\0';
|
||||||
name = nameBuffer;
|
name = nameBuffer;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// notify query listeners
|
// notify query listeners
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user