atempted fix for bug 210886

View: New views
4 Messages — Rating Filter:   Alert me  

atempted fix for bug 210886

by Lukas Middendorf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have spent some time digging through the code to fix Bug 210886. I have
attached my results. Does anybody see problems with the changes?

Regards,
Lukas

[210886_calc.diff]

Index: kstars.cpp
===================================================================
--- kstars.cpp (revision 1045371)
+++ kstars.cpp (working copy)
@@ -57,7 +57,7 @@
         AAVSODialog(0), findDialog(0), obsList(0),
         execute(0),
         avt(0), wut(0), skycal(0),
-        sb(0), pv(0), jmt(0), fm(0), indimenu(0), indidriver(0), indiseq(0),
+        sb(0), pv(0), jmt(0), fm(0), astrocalc(0), indimenu(0), indidriver(0), indiseq(0),
         DialogIsObsolete(false), StartClockRunning( clockrun ),
         StartDateString( startdate )
 {
Index: kstars.h
===================================================================
--- kstars.h (revision 1045371)
+++ kstars.h (working copy)
@@ -43,6 +43,7 @@
 class AltVsTime;
 class LCGenerator;
 class WUTDialog;
+class AstroCalc;
 class SkyCalendar;
 class ScriptBuilder;
 class PlanetViewer;
@@ -669,6 +670,7 @@
     PlanetViewer *pv;
     JMoonTool *jmt;
     FlagManager *fm;
+    AstroCalc *astrocalc;
 
     INDIMenu *indimenu;
     INDIDriver *indidriver;
Index: kstarsactions.cpp
===================================================================
--- kstarsactions.cpp (revision 1045371)
+++ kstarsactions.cpp (working copy)
@@ -177,9 +177,8 @@
 /** Major Dialog Window Actions **/
 
 void KStars::slotCalculator() {
-    QPointer<AstroCalc> astrocalc = new AstroCalc (this);
-    astrocalc->exec();
-    delete astrocalc;
+    if(!astrocalc) astrocalc = new AstroCalc (this);
+    astrocalc->show();
 }
 
 void KStars::slotWizard() {


[210886_details.diff]

Index: skymap.cpp
===================================================================
--- skymap.cpp (revision 1045371)
+++ skymap.cpp (working copy)
@@ -623,8 +623,7 @@
         return;
     }
     QPointer<DetailDialog> detail = new DetailDialog( clickedObject(), data->ut(), data->geo(), KStars::Instance() );
-    detail->exec();
-    delete detail;
+    detail->show();
 }
 
 void SkyMap::slotClockSlewing() {


_______________________________________________
Kstars-devel mailing list
Kstars-devel@...
https://mail.kde.org/mailman/listinfo/kstars-devel

Re: atempted fix for bug 210886

by Khudyakov Alexey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

В сообщении от Пятница 06 ноября 2009 03:50:18 автор Lukas Middendorf написал:
> Hi,
>
> I have spent some time digging through the code to fix Bug 210886. I have
> attached my results. Does anybody see problems with the changes?
>

Patch for calculator is fine. Only could you use
> if( condition )
>     someAction();
instead of
> if( condition ) someAction()
It's easier to read code this way

Patch for detail dialog will leak memory. DetailDialog isn't going to be
deleted. It could be adressed with setAttribute(Qt::WA_DeleteOnClose) and
QPointer usage is superficial. Raw pointer will do just fine.

Thank you for you work.
_______________________________________________
Kstars-devel mailing list
Kstars-devel@...
https://mail.kde.org/mailman/listinfo/kstars-devel

Re: atempted fix for bug 210886

by Lukas Middendorf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Friday 06 November 2009 schrieb Khudyakov Alexey:

> Only could you use
>
> > if( condition )
> >     someAction();
>
> instead of
>
> > if( condition ) someAction()
>
> It's easier to read code this way
I tried to resemble the code for wut in the same file, but I have changed that
now


> Patch for detail dialog will leak memory. DetailDialog isn't going to be
> deleted. It could be adressed with setAttribute(Qt::WA_DeleteOnClose)

I guessed that this might be happening.

> and QPointer usage is superficial. Raw pointer will do just fine.

Sure.

I have two new patches.

[210886_1.diff]

Index: kstars.cpp
===================================================================
--- kstars.cpp (revision 1045411)
+++ kstars.cpp (working copy)
@@ -57,7 +57,7 @@
         AAVSODialog(0), findDialog(0), obsList(0),
         execute(0),
         avt(0), wut(0), skycal(0),
-        sb(0), pv(0), jmt(0), fm(0), indimenu(0), indidriver(0), indiseq(0),
+        sb(0), pv(0), jmt(0), fm(0), astrocalc(0), indimenu(0), indidriver(0), indiseq(0),
         DialogIsObsolete(false), StartClockRunning( clockrun ),
         StartDateString( startdate )
 {
Index: kstars.h
===================================================================
--- kstars.h (revision 1045411)
+++ kstars.h (working copy)
@@ -43,6 +43,7 @@
 class AltVsTime;
 class LCGenerator;
 class WUTDialog;
+class AstroCalc;
 class SkyCalendar;
 class ScriptBuilder;
 class PlanetViewer;
@@ -669,6 +670,7 @@
     PlanetViewer *pv;
     JMoonTool *jmt;
     FlagManager *fm;
+    AstroCalc *astrocalc;
 
     INDIMenu *indimenu;
     INDIDriver *indidriver;
Index: kstarsactions.cpp
===================================================================
--- kstarsactions.cpp (revision 1045411)
+++ kstarsactions.cpp (working copy)
@@ -177,9 +177,9 @@
 /** Major Dialog Window Actions **/
 
 void KStars::slotCalculator() {
-    QPointer<AstroCalc> astrocalc = new AstroCalc (this);
-    astrocalc->exec();
-    delete astrocalc;
+    if( ! astrocalc )
+        astrocalc = new AstroCalc (this);
+    astrocalc->show();
 }
 
 void KStars::slotWizard() {


[210886_2.diff]

Index: skymap.cpp
===================================================================
--- skymap.cpp (revision 1045411)
+++ skymap.cpp (working copy)
@@ -622,9 +622,9 @@
         KMessageBox::sorry( this, i18n("No object selected."), i18n("Object Details") );
         return;
     }
-    QPointer<DetailDialog> detail = new DetailDialog( clickedObject(), data->ut(), data->geo(), KStars::Instance() );
-    detail->exec();
-    delete detail;
+    DetailDialog* detail = new DetailDialog( clickedObject(), data->ut(), data->geo(), KStars::Instance() );
+    detail->setAttribute(Qt::WA_DeleteOnClose);
+    detail->show();
 }
 
 void SkyMap::slotClockSlewing() {


_______________________________________________
Kstars-devel mailing list
Kstars-devel@...
https://mail.kde.org/mailman/listinfo/kstars-devel

Re: atempted fix for bug 210886

by Khudyakov Alexey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

В сообщении от 06 ноября 2009 18:16:03 Lukas Middendorf написал:
> I have two new patches.
>
Applied.

Thanks a lot.
_______________________________________________
Kstars-devel mailing list
Kstars-devel@...
https://mail.kde.org/mailman/listinfo/kstars-devel