mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-03 16:13:43 +00:00
Fix crash on UI tests
Generating paint messages without a she::System available.
This commit is contained in:
parent
ee8c434d2f
commit
66e9cee3e6
@ -610,12 +610,14 @@ void Manager::handleWindowZOrder()
|
||||
void Manager::dispatchMessages()
|
||||
{
|
||||
// Send messages in the queue (mouse/key/timer/etc. events) This
|
||||
// might change the state of widgets, etc.
|
||||
pumpQueue();
|
||||
|
||||
// Generate and send only kPaintMessages with the latest UI state.
|
||||
flushRedraw();
|
||||
pumpQueue();
|
||||
// might change the state of widgets, etc. In case pumpQueue()
|
||||
// returns a number greater than 0, it means that we've processed
|
||||
// some messages, so we've to redraw the screen.
|
||||
if (pumpQueue() > 0) {
|
||||
// Generate and send just kPaintMessages with the latest UI state.
|
||||
flushRedraw();
|
||||
pumpQueue();
|
||||
}
|
||||
|
||||
// Flip the back-buffer to the real display.
|
||||
flipDisplay();
|
||||
@ -1219,12 +1221,13 @@ void Manager::onSizeHint(SizeHintEvent& ev)
|
||||
ev.setSizeHint(gfx::Size(w, h));
|
||||
}
|
||||
|
||||
void Manager::pumpQueue()
|
||||
int Manager::pumpQueue()
|
||||
{
|
||||
#ifdef LIMIT_DISPATCH_TIME
|
||||
base::tick_t t = base::current_tick();
|
||||
#endif
|
||||
|
||||
int count = 0; // Number of processed messages
|
||||
auto it = msg_queue.begin();
|
||||
while (it != msg_queue.end()) {
|
||||
#ifdef LIMIT_DISPATCH_TIME
|
||||
@ -1289,7 +1292,10 @@ void Manager::pumpQueue()
|
||||
|
||||
// Destroy the message
|
||||
delete first_msg;
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
bool Manager::sendMessageToWidget(Message* msg, Widget* widget)
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -149,7 +149,7 @@ namespace ui {
|
||||
const double magnification);
|
||||
void handleWindowZOrder();
|
||||
|
||||
void pumpQueue();
|
||||
int pumpQueue();
|
||||
bool sendMessageToWidget(Message* msg, Widget* widget);
|
||||
|
||||
static void removeWidgetFromRecipients(Widget* widget, Message* msg);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -24,7 +24,7 @@ Message::Message(MessageType type, KeyModifiers modifiers)
|
||||
, m_used(false)
|
||||
, m_fromFilter(false)
|
||||
{
|
||||
if (modifiers == kKeyUninitializedModifier)
|
||||
if (modifiers == kKeyUninitializedModifier && she::instance())
|
||||
m_modifiers = she::instance()->keyModifiers();
|
||||
else
|
||||
m_modifiers = modifiers;
|
||||
|
Loading…
x
Reference in New Issue
Block a user