diff --git a/gambatte_qt/src/framework/src/inputbox.cpp b/gambatte_qt/src/framework/src/inputbox.cpp index 684b7492..b2e00f50 100644 --- a/gambatte_qt/src/framework/src/inputbox.cpp +++ b/gambatte_qt/src/framework/src/inputbox.cpp @@ -22,6 +22,7 @@ #include #include #include +#include static const char* keyToString(int key) { switch (key) { @@ -356,16 +357,13 @@ InputBox::InputBox(QWidget *nextFocus) } void InputBox::contextMenuEvent(QContextMenuEvent *event) { - QMenu *const menu = new QMenu(this); - + const std::auto_ptr menu(new QMenu(this)); menu->addAction(tr("&Copy"), this, SLOT(copy()))->setEnabled(hasSelectedText()); menu->addSeparator(); menu->addAction(tr("&Select All"), this, SLOT(selectAll()))->setEnabled(!displayText().isEmpty()); menu->addSeparator(); menu->addAction(tr("C&lear"), this, SLOT(clearData()))->setEnabled(getData().value != NULL_VALUE); menu->exec(event->globalPos()); - - delete menu; } void InputBox::focusInEvent(QFocusEvent *event) {