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

QT: Fixed xtt_op and xtt_ev destructors.

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