Commit 5de24943 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Fixed xtt_op and xtt_ev destructors.

parent 1e1b8952
......@@ -40,7 +40,12 @@
#include <string.h>
#include <time.h>
int DEBUG = 0;
static int DEBUG = 0;
void setDebug(int debug)
{
DEBUG = debug;
}
void print_time(FILE* stream, int fulldate)
{
......
......@@ -41,6 +41,8 @@
#include <stdio.h>
void setDebug(int debug);
void print_time(FILE* stream, int fulldate = 0);
void dbg_print(const char* file, int line, const char* fmt, ...);
......
......@@ -398,7 +398,7 @@ pwr_tStatus mh_OutunitDisconnect()
/* Disconnect all handlers and free memory */
LstForEach(hl, &l.handler_l) {
for (hl = l.handler_l.next; hl != &l.handler_l; hl = l.handler_l.next) {
hp = LstEntry(hl, sHandler, handler_l);
sendToHandler(hp, mh_eMsg_OutunitDisconnect, 0, NULL);
ackListDestroy(hp);
......@@ -541,7 +541,7 @@ static void ackListDestroy(sHandler* hp)
sAck* ap;
struct LstHead * al;
LstForEach(al, &hp->ack_l) {
for (al = hp->ack_l.next; al != &(hp->ack_l); al = hp->ack_l.next) {
ap = LstEntry(al, sAck, ack_l);
LstRemove(al);
LstNull(al);
......
......@@ -54,7 +54,6 @@
void CLogQtWidget::closeEvent(QCloseEvent* event)
{
debug_print("CLogQtWidget::closeEvent\n");
if (clog->close_cb) {
(clog->close_cb)(clog->parent_ctx);
} else {
......@@ -67,7 +66,6 @@ CLogQt::CLogQt(void* clog_parent_ctx, QWidget* clog_parent_wid,
const char* clog_name, pwr_tStatus* status)
: CLog(clog_parent_ctx, clog_name, status), parent_wid(clog_parent_wid)
{
debug_print("\n");
toplevel = new CLogQtWidget(this, clog_parent_wid);
toplevel->setToolTip(fl("xtt_clog widget"));
toplevel->setMinimumSize(1000, 800);
......
......@@ -54,7 +54,7 @@
class CallbackWidget : public QDialog {
public:
CallbackWidget(EvQtObject* parent, void (EvQtObject::*close)(), void (EvQtObject::*focus)())
: QDialog(), ev(parent), close_cb(close), focus_cb(focus){}
: QDialog(), ev(parent), close_cb(close), focus_cb(focus) {}
protected:
void closeEvent(QCloseEvent* event);
......@@ -68,7 +68,6 @@ private:
void CallbackWidget::closeEvent(QCloseEvent* event)
{
debug_print("CallbackWidget::closeEvent\n");
((ev)->*(close_cb))();
QDialog::closeEvent(event);
}
......@@ -126,7 +125,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
parent_wid_eve->setMinimumSize(eve_width, eve_height);
parent_wid_eve->setToolTip(fl("xtt_ev eve widget"));
parent_wid_eve->setWindowTitle(translate_utf8(eve_name));
parent_wid_eve->setAttribute(Qt::WA_DeleteOnClose);
// Do not set the DeleteOnClose attribute.
CoWowQt::SetWindowIcon(parent_wid_eve);
......@@ -228,10 +227,10 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
{
parent_wid_ala = new CallbackWidget(
object, &EvQtObject::ala_activate_exit, &EvQtObject::ala_action_inputfocus);
parent_wid_eve->setToolTip(fl("xtt_ev ala widget"));
parent_wid_ala->setToolTip(fl("xtt_ev ala widget"));
parent_wid_ala->setMinimumSize(ala_width, ala_height);
parent_wid_ala->setWindowTitle(translate_utf8(ala_name));
parent_wid_ala->setAttribute(Qt::WA_DeleteOnClose);
// Do not set the DeleteOnClose attribute.
CoWowQt::SetWindowIcon(parent_wid_ala);
......@@ -366,10 +365,10 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
{
parent_wid_blk = new CallbackWidget(
object, &EvQtObject::blk_activate_exit, &EvQtObject::blk_action_inputfocus);
parent_wid_eve->setToolTip(fl("xtt_ev blk widget"));
parent_wid_blk->setToolTip(fl("xtt_ev blk widget"));
parent_wid_blk->setMinimumSize(blk_width, blk_height);
parent_wid_blk->setWindowTitle(translate_utf8(blk_name));
parent_wid_blk->setAttribute(Qt::WA_DeleteOnClose);
// Do not set the DeleteOnClose attribute.
CoWowQt::SetWindowIcon(parent_wid_blk);
......@@ -514,7 +513,6 @@ EvEve* EvQt::open_eventlist_satellite(const char* title, pwr_tStatus* sts,
EvQt::~EvQt()
{
debug_print("EvQt::~EvQt\n");
if (connected) {
mh_OutunitDisconnect();
}
......@@ -528,6 +526,25 @@ EvQt::~EvQt()
((EvAlaQt*)sala[i])->toplevel->close();
}
}
if (eve) {
delete eve;
}
if (ala) {
delete ala;
}
if (blk) {
delete blk;
}
ala = eve = blk = NULL;
if (parent_wid_eve) {
delete parent_wid_eve;
}
if (parent_wid_ala) {
delete parent_wid_ala;
}
if (parent_wid_blk) {
delete parent_wid_blk;
}
if (object)
delete object;
}
......
......@@ -53,7 +53,6 @@ EvListQt::EvListQt(void* ev_parent_ctx, QWidget* ev_parent_wid,
void (*ev_init_cb)(void*))
: EvList(ev_parent_ctx, ev_type, ev_size, ev_eventname_seg, ev_init_cb)
{
debug_print("creating a scrolledbrowwidgetqt\n");
form_widget = scrolledbrowwidgetqt_new(init_brow_cb, this, &brow_widget);
form_widget->show();
......@@ -63,7 +62,6 @@ EvListQt::EvListQt(void* ev_parent_ctx, QWidget* ev_parent_wid,
EvListQt::~EvListQt()
{
debug_print("EvListQt::~EvListQt\n");
if (browtree) {
delete browtree->ctx;
}
......
......@@ -56,6 +56,7 @@
#include "xtt_op_qt.h"
#include <QApplication>
#include <QCloseEvent>
#include <QDesktopWidget>
#include <QPushButton>
......@@ -138,7 +139,6 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace,
: Op(op_parent_ctx, opplace, status), title_label(0), a_height(2),
text_size(12)
{
debug_print("\n");
pwr_tStatus sts;
memset(a_exist, 0, sizeof(a_exist));
......@@ -494,7 +494,6 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace,
OpQt::~OpQt()
{
debug_print("OpQt::~OpQt\n");
if (jop) {
delete jop;
}
......@@ -505,15 +504,13 @@ OpQt::~OpQt()
if (wow) {
delete wow;
}
delete toplevel;
}
void OpQtWidget::closeEvent(QCloseEvent* event)
{
debug_print("OpQtWidget::closeEvent\n");
if (op->close_cb) {
(op->close_cb)(op->parent_ctx);
}
QWidget::closeEvent(event);
op->activate_exit();
event->ignore();
}
void OpQt::map()
......
......@@ -129,6 +129,12 @@ XNavQt::~XNavQt()
brow_DeleteSecondaryCtx(collect_brow->ctx);
delete collect_brow;
delete brow;
if (ev) {
delete ev;
}
if (op) {
delete op;
}
form_widget->close();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment