mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-30 06:32:36 +00:00
Was referencing a stack allocated variable from a lambda that was called
from a different stack. Ugh.
This commit is contained in:
parent
8ccb1b8fd4
commit
93acbbb7a5
@ -278,9 +278,9 @@ void TrackList::CacheWindow(size_t from, size_t to, bool async) const {
|
||||
if (async) {
|
||||
currentWindow.Set(from, to);
|
||||
auto shared = shared_from_this(); /* ensure we remain alive for the duration of the query */
|
||||
bool completionFinished = false;
|
||||
auto completion = [this, &completionFinished, shared, from, to, query](auto q) {
|
||||
if (completionFinished) {
|
||||
auto completionFinished = std::make_shared<bool>(false); /* ugh... keep it alive. */
|
||||
auto completion = [this, completionFinished, shared, from, to, query](auto q) {
|
||||
if (*completionFinished) {
|
||||
return;
|
||||
}
|
||||
if (query->GetStatus() == IQuery::Finished) {
|
||||
@ -296,7 +296,7 @@ void TrackList::CacheWindow(size_t from, size_t to, bool async) const {
|
||||
this->CacheWindow(from, to, true);
|
||||
}
|
||||
this->WindowCached(const_cast<TrackList*>(this), from, to);
|
||||
completionFinished = true;
|
||||
*completionFinished = true;
|
||||
};
|
||||
|
||||
this->library->EnqueueAndWait(query, kCacheWindowTimeoutMs, completion);
|
||||
|
48
src/musikcube/cursespp/cursespp/InternalWindowMessages.h
Normal file
48
src/musikcube/cursespp/cursespp/InternalWindowMessages.h
Normal file
@ -0,0 +1,48 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2004-2020 musikcube team
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// * Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace cursespp {
|
||||
namespace InternalWindowMessages {
|
||||
/* range of message ids reserved for internal use. exercise caution if
|
||||
creating your own messages within this range. */
|
||||
static const int kLastReservedMessageId = INT_MAX;
|
||||
static const int kFirstReservedMessageId = kLastReservedMessageId - 1024;
|
||||
|
||||
static const int NotifyVisibilityChanged = kFirstReservedMessageId + 1;
|
||||
static const int NotifyChildFocusChanged = kFirstReservedMessageId + 2;
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user