Bug 110498 - unitialized attribute in quanta.cpp show weird column and line number
Summary: unitialized attribute in quanta.cpp show weird column and line number
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-10 08:19 UTC by Yan Morin
Modified: 2005-08-10 12:58 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yan Morin 2005-08-10 08:19:33 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Condition
1. Close Quanta with an open project and open files
2. Open Quanta 
2.1 Quanta open the project
2.1.1 Quanta open the project's files
2.1.2 ViewManager::slotViewActivated is called (by an emit signal)
2.1.3 ViewManager call quantaApp->slotNewLineColumn();
2.1.4 cursorLine and cursorCol attribute are used before being initialized (line 1520 of quanta.cpp: QuantaApp::slotNewLineColumn())
2.1.5 there is weird Line/Column value in the status bar

A solution to remove this strange behavior could be to initialize the two attributes in the QuantaApp constructor:

Index: quanta.cpp
===================================================================
--- quanta.cpp  (révision 443949)
+++ quanta.cpp  (copie de travail)
@@ -253,6 +253,10 @@
   m_newDocStuff = 0L;
   m_debugger = 0L;
   m_parserEnabled = true;
+
+  cursorLine=0;
+  cursorCol=0;
+
   emit eventHappened("quanta_start", QDateTime::currentDateTime().toString(Qt::ISODate), QString::null);
 }


the attribute are initialized because the slotNewLineColumn method add 1 to each.
Comment 1 András Manţia 2005-08-10 12:58:32 UTC
SVN commit 444480 by amantia:

Initialize variables. Patch by Yan Morin.
Don't you want to join our developer list? ;-)
BUG:110498

 M  +3 -3      quanta.kdevelop  
 M  +2 -0      src/quanta.cpp  


--- branches/KDE/3.5/kdewebdev/quanta/quanta.kdevelop #444479:444480
@@ -168,7 +168,7 @@
     </groups>
     <tree>
       <hidenonprojectfiles>false</hidenonprojectfiles>
-      <hidepatterns></hidepatterns>
+      <hidepatterns/>
       <showvcsfields>true</showvcsfields>
     </tree>
   </kdevfileview>
@@ -243,10 +243,10 @@
   </kdevcvs>
   <kdevfilecreate>
     <filetypes>
-      <type icon="" ext="h" create="template" name="C++ header" >
+      <type icon="" ext="h" name="C++ header" create="template" >
         <descr>Quanta speicfic header</descr>
       </type>
-      <type icon="source_cpp" ext="cpp" create="template" name="C++ source" >
+      <type icon="source_cpp" ext="cpp" name="C++ source" create="template" >
         <descr>A new empty C++ file.</descr>
       </type>
     </filetypes>
--- branches/KDE/3.5/kdewebdev/quanta/src/quanta.cpp #444479:444480
@@ -253,6 +253,8 @@
   m_newDocStuff = 0L;
   m_debugger = 0L;
   m_parserEnabled = true;
+  cursorLine = 0;
+  cursorCol = 0;
   emit eventHappened("quanta_start", QDateTime::currentDateTime().toString(Qt::ISODate), QString::null);
 }