History log of /haiku/src/kits/storage/PathMonitor.cpp
Revision Date Author Comments
# 7bdc1a19 29-Jul-2019 Adrien Destugues <pulkomandy@pulkomandy.tk>

PVS V522: PathMonitor: NULL pointer dereference

Change-Id: I77df9c18960eee0183145441d3a1bd4ceb112147
Reviewed-on: https://review.haiku-os.org/c/1662
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 9216fc01 18-Jun-2018 Augustin Cavalier <waddlesplash@gmail.com>

More class/struct mixup fixes.

Spotted by Clang.


# ab306fb8 09-Nov-2015 Michael Lotz <mmlr@mlotz.ch>

BPathMonitor: Fix locking order reversal introduced in 8599f4b.

The sLocker was used as an outer lock with the sLooper locked within.
The sLocker therefore can't be used within MessageReceived() as that
could lead to deadlocks due to reversal of the locking order.

Instead of two locks, just use locking the looper for all serialization.
While this has a higher overhead to using a BLocker (due to the looper
list locking and lookups) this shouldn't be too problematic.


# c869b2bb 07-Nov-2015 Michael Lotz <mmlr@mlotz.ch>

BPathMonitor: Remove unused headers, some whitespace cleanup.


# 8599f4b3 07-Nov-2015 Michael Lotz <mmlr@mlotz.ch>

BPathMonitor: Lock on incoming node monitor messages.

The lock was only acquired when paths to watch were added or removed,
protecting the data structures against concurrent modification due
to addition/removal of entries by the API user.

Locking is also required for node monitor messages since these can
trigger the data structures to be modified (due to recursive watching
and new directories becoming available or due to resyncing of modified
ancestor chains).

Previously it was possible to corrupt the data structures when node
monitor messages were received while still starting to watch a directory
structure. This was especially likely in the case of watching devfs
directories, as accessing these can trigger device scanning which in
turn could possibly add new device entries. Either the path monitor
looper or the API user would then trip over the corrupted data
structures.

Probably fixes #11280. Although I was only able to reproduce crashes
on the API side, corruption of the hash tables and corresponding endless
loops are quite plausible.

Possibly also fixes #12412 if the input_server was in the process of
starting to watch entries. It's hard to tell due to the lack of a back
trace but would fit the crashes I was able to reproduce with a synthetic
test case.


# c71a35bd 22-Jan-2014 Jérôme Duval <jerome.duval@gmail.com>

PathMonitor: check for NULL before dereferencing.

* should fix #10277.


# f466a0b8 05-Jan-2014 noryb009 <noryb009@hotmail.com>

Fix Coverity CID 1108465: Use after free

Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>


# e19f9091 29-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: add "from path" to B_ENTRY_MOVED notifications


# 04382d49 27-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: rewrite

This resolves all issues the test suite uncovered. It should also deal
with hard links correctly, though that hasn't been tested. Still
unsupported are:
* changes due to mounting/unmounting a volume,
* tracking of symlinks in the path components.


# 38afe232 23-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: pass BMessenger by reference


# 7b198d81 23-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

B_WATCH_FOLDERS_ONLY -> B_WATCH_DIRECTORIES_ONLY

Stick to the nomenclature generally used in the public API.


# 3209bc40 22-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: PathHandler::_NotifyTarget(): simplify

* Add optional entry_ref return parameter to _HasFile().
* Simplify _NotifyTarget() by using _HasDirectory() and _HasFile().


# 77ca66cd 20-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: make the node watching mechanism configurable

Add inner class BWatchingInterface and method SetWatchingInterface().
This abstracts the calls to watch_node() and stop_watching(), thus
making it possible to use the path monitor in Tracker.


# ad1875fd 20-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: use pthread_once for initialization


# 6ca95bd8 20-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

PathMonitor.cpp: some style cleanup


# 27d38ee9 23-Dec-2010 Marcus Overhagen <marcusoverhagen@gmail.com>

Drop into debugger if the looper can't be locked.
This gets triggered randomly by net_server.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39934 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c411bbc0 07-Jun-2010 Stephan Aßmus <superstippi@gmx.de>

Resolved TODO about recursively removing watched files and folders when a
directory is moved outside the watched hierarchy or deleted entirely. It
involves another TODO, because the generated notifications are B_ENTRY_REMOVED,
while B_ENTRY_MOVED is probably more correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37049 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cee04e80 08-Feb-2010 Artur Wyszynski <aljen-mlists@o2.pl>

Fixed various errors/warnings reported by cppcheck:
* memory leaks
* resource leaks
* added const's to getters
* removed a few reundant conditions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35433 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6eb09230 01-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Resolve further warnings on GCC4.
* Enable -Werror on GCC4 builds as well (limited to the same selected targets).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29118 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c1e7c02d 19-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* If only files are watched, PathHandler::_AddFile() will now notify the target
when it was called from a notification function.
* This means you'll no longer have to watch (and scan) directories when you're
interested in new files alone. Maybe this functionality could be used for
other cases as well, or be activated only via an additional flag.
Opinions? Stippi? :-)
* TRACE() no goes to /dev/dprintf by default, added a bit more trace output.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28237 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3f953c83 12-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

Added clarifying comment for something that puzzled me at first.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26946 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8a0be4ed 12-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* I misunderstood the previous of adding fPath.Path() to the message. It was
meant to be able to tell which monitor the message came from. So I added it
back in. Since I used "path" already for the entry, I renamed the field to
"watched_path". No code was using it yet, so this should be ok and the
purpose more clear anyways.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26945 a95241bf-73f2-0310-859d-f6bbb57e9c96


# afbd081a 11-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* TRACE macro no longer needs double parenthesis.
* The global BPathMonitor looper is now always used, no more optional looper
and no more BApplication looper usage. This way we know how the looper behaves
and PathHandler::Quit() can be synchronous. In the end, the bug I was
observing was not caused by the previous asynchronous node monitor stopping,
but this should be safer anyways. When BPathMonitor::StopWatching() returns,
you have really stopped watching and not some time later.
* Introduced "FileEntry" which is an entry_ref plus node id. This is now used
instead of the node_ref for the "watched files set". The whole point
is to really be able to add the "path" field to the B_PATH_MONITOR message.
Previously, the initial path that was passed to StartWatching() was added,
regardless if the message was for an entry somewhere down the hierarchy when
watching recursively. The downside of the new method is that it uses a lot
more RAM per entry. Another option would be to store the node id of the parent
directory and iterate the directory always when in need to construct the path.
* Watching a folder recursively now really adds all the existing subfolders
as well as all the files if not watching for folders only. The tests for the
old implementation only tested what happens when the watched folder was newly
created and then subfolders were created. Those where already added by the
code. Now it also adds the subfolders of folder that appear in a watched
folder.
TODO: Remove folders and files recursively when they dissappear. More testing
for B_ENTRY_MOVED. Optimizations are possible when some information is
retrieved twice. I am also planning to add a way for the BPathMonitor user to
filter the automatically watched files/folders in B_WATCH_RECURSIVELY mode.

I grepped the entire Haiku tree for usage of BPathMonitor. Only net_server
and Mail were using it, but both in a way that is not affected by these
changes. Anyways, TextSearch works more reliable now, even for entries in
subfolders.

Feedback very welcome! :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26936 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ef86fce 08-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* Rename the private structs to use the same scheme as for classes, which seems
to be the habbit now.
* Improve PathHandler::Quit() to delete the object in case the BMessenger was
not valid or failed to send the Quit message. This should handle the corner
case that the PathHandler's looper was already Quit(). There could still be
a race condition, although I don't know if it affects local message targets
in Haiku. I added a TODO note for that, but I believe it can be neglected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26877 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f7c226f4 06-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* StartWatching() now takes an optional BLooper pointer. This looper will
then be used for receiving node monitoring messages.
* Reenabled using be_app as default BLooper if the API user does not provide
one. I think the problem that Stefano needed to work aroung in r23995 was
actually caused by the incorrect locking (an never unlocking) of the looper
before calling PathHandler::Quit().
->If I understand correctly, this code as supposed to work around the possible
situation that the looper holding those PathHandlers may have already quit,
leaving stale PathHandler pointers behind. But that case was not prevented
by the old code anyways, since one would have had to access freed memory to
even get the stale BLooper pointer. The real fix would be to store the
BLooper pointer with each PathHandler so that the possible gone-ness of
those loopers could be checked independent of accessing the PathHandler
pointer. (The whole problem is that PathHandler adds itself to the BLooper
and if the looper quits, it will free all its attached handlers.)
* Introduced a global fallback BLooper for the case that no BApplication is
running, which resolves a TODO.

All this is yet untested, but should have a good chance of working.
(Famous last words...)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26843 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9ab16e2 04-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* Move the LockLooper() call before PathHandler::Quit() into Quit().
* The B_QUIT_REQUESTED message never arrived for me unless I unlock the
BLooper again, then it works as expected.
* The B_QUIT_REQUESTED handling accessed fOwnsLooper after deleting the
object.
(Review much welcome - I don't understand the purpose of locking the BLooper
at all before trying to use a BMessenger to send it a message.)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26805 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e8f39ce9 04-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

Don't choke in BPathMonitor::StopWatch(...) if the client never called
StartWatching() before and the BPathMonitor stuff is therefor not initialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26792 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b5bc41de 04-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* Use new header layout in PathMonitor.h
* Honor 80 char/line limit in PathMonitor.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26788 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e0ba90d 18-Feb-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

We can't use the be_app looper, since it can be already locked from
another thread (for example, when quitting the app/window), and that
would cause a deadlock. Fixes bug #1645.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23995 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 20b56fdd 24-Oct-2007 Stephan Aßmus <superstippi@gmx.de>

* actually initialize the static sLocker with NULL too...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22700 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c41c3f9b 06-Jul-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

gcc4 compile fix, but C++ predicates are ugly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21579 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 896aa538 06-Jul-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

gcc4 fix


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21578 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2702a877 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a work-around if the file to be watched does actually exist when starting
to watch it.
* Now adds the path to be watched to the update message (not the path of the
file that actually changed, though).
* Made debug output conditionally compiled in when TRACE_PATH_MONITOR is defined.
* Added PathMonitor.cpp to libbe.so


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21554 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 618b37dc 05-Jun-2007 Axel Dörfler <axeld@pinc-software.de>

Fixed various incorrect uses of the erase() method of several STL containers I introduced before. Thanks to Stefano for the hint!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21332 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d00539e3 07-May-2007 Axel Dörfler <axeld@pinc-software.de>

* Revamped BPathMonitor API as suggested by Ingo - we could rename it to BNodeMonitor
and add wrappers for watch_node() as well, though.
* Implemented more or less all what is needed for the path monitoring to work.
* Added a test application: works fine under Haiku, but somewhat flaky under BeOS,
dunno why yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21066 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f30198a0 04-May-2007 Axel Dörfler <axeld@pinc-software.de>

* Implemented PathMonitor class - untested, but compiles.
* The API is just a proposal at this time, please comment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21020 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c71a35bdd5f115d82a0c35b59ab4f6b9077c5588 22-Jan-2014 Jérôme Duval <jerome.duval@gmail.com>

PathMonitor: check for NULL before dereferencing.

* should fix #10277.


# f466a0b81edfbe4d979d0617aa154babbb6a783e 05-Jan-2014 noryb009 <noryb009@hotmail.com>

Fix Coverity CID 1108465: Use after free

Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>


# e19f9091cd5c744b6bd3fe5f7f16a8eb56e6ef12 29-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: add "from path" to B_ENTRY_MOVED notifications


# 04382d496e445d90a3aab7c8752ee9cb59825035 27-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: rewrite

This resolves all issues the test suite uncovered. It should also deal
with hard links correctly, though that hasn't been tested. Still
unsupported are:
* changes due to mounting/unmounting a volume,
* tracking of symlinks in the path components.


# 38afe232de0aba455fb21897ac8a739dd5793e52 23-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: pass BMessenger by reference


# 7b198d812e45dfdaf08d5660fec27b3b4acf2a6f 23-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

B_WATCH_FOLDERS_ONLY -> B_WATCH_DIRECTORIES_ONLY

Stick to the nomenclature generally used in the public API.


# 3209bc40c523d63e98d635ae302df6bece0966d3 22-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: PathHandler::_NotifyTarget(): simplify

* Add optional entry_ref return parameter to _HasFile().
* Simplify _NotifyTarget() by using _HasDirectory() and _HasFile().


# 77ca66cdb7b44669fc03e80e084234bee21bfd0e 20-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: make the node watching mechanism configurable

Add inner class BWatchingInterface and method SetWatchingInterface().
This abstracts the calls to watch_node() and stop_watching(), thus
making it possible to use the path monitor in Tracker.


# ad1875fd705fe89064bcc91788ab4a05d14bf59d 20-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPathMonitor: use pthread_once for initialization


# 6ca95bd81343ac9be3836d112cf5e079a6e6ff9f 20-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

PathMonitor.cpp: some style cleanup


# 27d38ee9761fb45cf4fd48e000402b0bb3c4df15 23-Dec-2010 Marcus Overhagen <marcusoverhagen@gmail.com>

Drop into debugger if the looper can't be locked.
This gets triggered randomly by net_server.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39934 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c411bbc095d5d7a50a95946df610a349a525f65e 07-Jun-2010 Stephan Aßmus <superstippi@gmx.de>

Resolved TODO about recursively removing watched files and folders when a
directory is moved outside the watched hierarchy or deleted entirely. It
involves another TODO, because the generated notifications are B_ENTRY_REMOVED,
while B_ENTRY_MOVED is probably more correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37049 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cee04e8074ec61fd8c6dac3539c5b821c3618888 08-Feb-2010 Artur Wyszynski <aljen-mlists@o2.pl>

Fixed various errors/warnings reported by cppcheck:
* memory leaks
* resource leaks
* added const's to getters
* removed a few reundant conditions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35433 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6eb09230bae52bcdf045e1f1920b67205c29adc8 01-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Resolve further warnings on GCC4.
* Enable -Werror on GCC4 builds as well (limited to the same selected targets).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29118 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c1e7c02d9e73fe446a403133a5a4868fa6a0f5e3 19-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* If only files are watched, PathHandler::_AddFile() will now notify the target
when it was called from a notification function.
* This means you'll no longer have to watch (and scan) directories when you're
interested in new files alone. Maybe this functionality could be used for
other cases as well, or be activated only via an additional flag.
Opinions? Stippi? :-)
* TRACE() no goes to /dev/dprintf by default, added a bit more trace output.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28237 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3f953c833c5a467d51b8479b38e4305612677695 12-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

Added clarifying comment for something that puzzled me at first.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26946 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8a0be4edeb4b6b8165c013c94b93ef5f865e8130 12-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* I misunderstood the previous of adding fPath.Path() to the message. It was
meant to be able to tell which monitor the message came from. So I added it
back in. Since I used "path" already for the entry, I renamed the field to
"watched_path". No code was using it yet, so this should be ok and the
purpose more clear anyways.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26945 a95241bf-73f2-0310-859d-f6bbb57e9c96


# afbd081a6fe420971f135720f917541815b7ad0a 11-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* TRACE macro no longer needs double parenthesis.
* The global BPathMonitor looper is now always used, no more optional looper
and no more BApplication looper usage. This way we know how the looper behaves
and PathHandler::Quit() can be synchronous. In the end, the bug I was
observing was not caused by the previous asynchronous node monitor stopping,
but this should be safer anyways. When BPathMonitor::StopWatching() returns,
you have really stopped watching and not some time later.
* Introduced "FileEntry" which is an entry_ref plus node id. This is now used
instead of the node_ref for the "watched files set". The whole point
is to really be able to add the "path" field to the B_PATH_MONITOR message.
Previously, the initial path that was passed to StartWatching() was added,
regardless if the message was for an entry somewhere down the hierarchy when
watching recursively. The downside of the new method is that it uses a lot
more RAM per entry. Another option would be to store the node id of the parent
directory and iterate the directory always when in need to construct the path.
* Watching a folder recursively now really adds all the existing subfolders
as well as all the files if not watching for folders only. The tests for the
old implementation only tested what happens when the watched folder was newly
created and then subfolders were created. Those where already added by the
code. Now it also adds the subfolders of folder that appear in a watched
folder.
TODO: Remove folders and files recursively when they dissappear. More testing
for B_ENTRY_MOVED. Optimizations are possible when some information is
retrieved twice. I am also planning to add a way for the BPathMonitor user to
filter the automatically watched files/folders in B_WATCH_RECURSIVELY mode.

I grepped the entire Haiku tree for usage of BPathMonitor. Only net_server
and Mail were using it, but both in a way that is not affected by these
changes. Anyways, TextSearch works more reliable now, even for entries in
subfolders.

Feedback very welcome! :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26936 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ef86fce1f070f539e9307b508ac9561f9cd5f2c 08-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* Rename the private structs to use the same scheme as for classes, which seems
to be the habbit now.
* Improve PathHandler::Quit() to delete the object in case the BMessenger was
not valid or failed to send the Quit message. This should handle the corner
case that the PathHandler's looper was already Quit(). There could still be
a race condition, although I don't know if it affects local message targets
in Haiku. I added a TODO note for that, but I believe it can be neglected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26877 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f7c226f46761738631518ef7051d9b1dfd2e15ed 06-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* StartWatching() now takes an optional BLooper pointer. This looper will
then be used for receiving node monitoring messages.
* Reenabled using be_app as default BLooper if the API user does not provide
one. I think the problem that Stefano needed to work aroung in r23995 was
actually caused by the incorrect locking (an never unlocking) of the looper
before calling PathHandler::Quit().
->If I understand correctly, this code as supposed to work around the possible
situation that the looper holding those PathHandlers may have already quit,
leaving stale PathHandler pointers behind. But that case was not prevented
by the old code anyways, since one would have had to access freed memory to
even get the stale BLooper pointer. The real fix would be to store the
BLooper pointer with each PathHandler so that the possible gone-ness of
those loopers could be checked independent of accessing the PathHandler
pointer. (The whole problem is that PathHandler adds itself to the BLooper
and if the looper quits, it will free all its attached handlers.)
* Introduced a global fallback BLooper for the case that no BApplication is
running, which resolves a TODO.

All this is yet untested, but should have a good chance of working.
(Famous last words...)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26843 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a9ab16e27c0181f0c12e9d09413526ff5df3d0e7 04-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* Move the LockLooper() call before PathHandler::Quit() into Quit().
* The B_QUIT_REQUESTED message never arrived for me unless I unlock the
BLooper again, then it works as expected.
* The B_QUIT_REQUESTED handling accessed fOwnsLooper after deleting the
object.
(Review much welcome - I don't understand the purpose of locking the BLooper
at all before trying to use a BMessenger to send it a message.)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26805 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e8f39ce96a3d85de56f6a1425a233b07a5fb54bd 04-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

Don't choke in BPathMonitor::StopWatch(...) if the client never called
StartWatching() before and the BPathMonitor stuff is therefor not initialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26792 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b5bc41debfcaa76eb340cde8108e36503ef872ee 04-Aug-2008 Stephan Aßmus <superstippi@gmx.de>

* Use new header layout in PathMonitor.h
* Honor 80 char/line limit in PathMonitor.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26788 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e0ba90d3fb77f4975b8bfea02b5b580dffc75ba 18-Feb-2008 Stefano Ceccherini <stefano.ceccherini@gmail.com>

We can't use the be_app looper, since it can be already locked from
another thread (for example, when quitting the app/window), and that
would cause a deadlock. Fixes bug #1645.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23995 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 20b56fdd92dfb7dafe568520c37ced7197afc507 24-Oct-2007 Stephan Aßmus <superstippi@gmx.de>

* actually initialize the static sLocker with NULL too...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22700 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c41c3f9bca017d4286b026289e8c562c9e558854 06-Jul-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

gcc4 compile fix, but C++ predicates are ugly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21579 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 896aa538d42146cf1e26ded94d893d5e0df904a0 06-Jul-2007 Marcus Overhagen <marcusoverhagen@gmail.com>

gcc4 fix


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21578 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2702a877acb9f45c7564344d6982db681c2fff96 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a work-around if the file to be watched does actually exist when starting
to watch it.
* Now adds the path to be watched to the update message (not the path of the
file that actually changed, though).
* Made debug output conditionally compiled in when TRACE_PATH_MONITOR is defined.
* Added PathMonitor.cpp to libbe.so


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21554 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 618b37dc4654dc94fd00d7ce6e0474c445633152 05-Jun-2007 Axel Dörfler <axeld@pinc-software.de>

Fixed various incorrect uses of the erase() method of several STL containers I introduced before. Thanks to Stefano for the hint!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21332 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d00539e3ba985c9438085f6ac10875183525f626 07-May-2007 Axel Dörfler <axeld@pinc-software.de>

* Revamped BPathMonitor API as suggested by Ingo - we could rename it to BNodeMonitor
and add wrappers for watch_node() as well, though.
* Implemented more or less all what is needed for the path monitoring to work.
* Added a test application: works fine under Haiku, but somewhat flaky under BeOS,
dunno why yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21066 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f30198a05113232c63144c30e753e7d983dccf3a 04-May-2007 Axel Dörfler <axeld@pinc-software.de>

* Implemented PathMonitor class - untested, but compiles.
* The API is just a proposal at this time, please comment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21020 a95241bf-73f2-0310-859d-f6bbb57e9c96