Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
e3ca386c
Commit
e3ca386c
authored
Feb 10, 2016
by
Hugo Beauzée-Luyssen
Browse files
MediaLibrary: Don't register modification hooks when no notifier has been created
parent
fb3d59ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/MediaLibrary.cpp
View file @
e3ca386c
...
...
@@ -150,6 +150,9 @@ bool MediaLibrary::createAllTables()
void
MediaLibrary
::
registerEntityHooks
()
{
if
(
m_deletionNotifier
==
nullptr
)
return
;
m_dbConnection
->
registerUpdateHook
(
policy
::
MediaTable
::
Name
,
[
this
](
SqliteConnection
::
HookReason
reason
,
int64_t
rowId
)
{
if
(
reason
!=
SqliteConnection
::
HookReason
::
Delete
)
...
...
@@ -174,6 +177,9 @@ bool MediaLibrary::initialize( const std::string& dbPath, const std::string& thu
m_callback
=
mlCallback
;
m_dbConnection
.
reset
(
new
SqliteConnection
(
dbPath
)
);
// Give a chance to test overloads to reject the creation of a notifier
startDeletionNotifier
();
// Which allows us to register hooks, or not, depending on the presence of a notifier
registerEntityHooks
();
if
(
createAllTables
()
==
false
)
...
...
@@ -190,7 +196,6 @@ bool MediaLibrary::initialize( const std::string& dbPath, const std::string& thu
}
startDiscoverer
();
startParser
();
startDeletionNotifier
();
return
true
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment