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:
Bruno G. Albuquerque
2006-09-22 02:55:54 +00:00
parent a3487fdca2
commit 7676dedf57
+19 -3
View File
@@ -1600,9 +1600,25 @@ Query::LiveUpdate(Inode *inode, const char *attribute, int32 type, const uint8 *
char nameBuffer[B_FILE_NAME_LENGTH];
if (name == NULL) {
if (inode->GetName(nameBuffer) != B_OK)
nameBuffer[0] = '\0';
name = nameBuffer;
// 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)
nameBuffer[0] = '\0';
name = nameBuffer;
}
}
// notify query listeners