Hi Pritpal

In STATIC FUNCTION Dialogs You are using local oDlg which
is overwriten many times (you should delete QWidgets pointed to by it,
before allocating new ones)

One solution (not going in other leaks) is this:


PROCEDURE Main()
   Local oLabel, oBtn, oDA, oTabBar
   Local oWnd, oSize
   Local oMenuBar, pIcon
   Local oMenuA, pAction
   LOCAL oPS, oPPrv, oMB, oWZ, oCD, oWP, oSBar, oStyle
   ****  Add code
   PUBLIC oDlg1:=oDlg2:=oDlg3:=oDlg4:=oDlg5:=oDlg6:=Nil
   *********
....


STATIC FUNCTION Dialogs( cType, w, l )

local oUrl

   DO CASE
   CASE cType == "PageSetup"
      if oDlg1 ==Nil
         oDlg1 := QPageSetupDialog():new()
         oDlg1:setWindowTitle( "Harbour-QT čššPageSetup Dialog" )
      endif
      oDlg1:show()
   CASE cType == "Preview"
      if oDlg2 ==Nil
         oDlg2 := QPrintPreviewDialog():new()
         oDlg2:setWindowTitle( "Harbour-QT Preview Dialog" )
      endif
      oDlg2:show()
   CASE cType == "Wizard"
      if oDlg3 ==Nil
         oDlg3 := QWizard():new()
         oDlg3:setWindowTitle( "Harbour-QT Wizard to Show Slides etc." )
      endif
      oDlg3:show()
   CASE cType == "Colors"
      if oDlg4 ==Nil
         oDlg4 := QColorDialog():new()
         oDlg4:setWindowTitle( "Harbour-QT Color Selection Dialog" )
      endif
      oDlg4:show()
      
   CASE cType == "WebPage"
      if oDlg5 ==Nil
         oDlg5 := QWebView():new()
         oUrl := QUrl():new()
         oUrl:setUrl( "http://www.harbour.vouch.info"; )
         QT_QWebView_SetUrl( QT_PTROF( oDlg5 ), QT_PTROF( oUrl ) )
         oDlg5:setWindowTitle( "Harbour-QT Web Page Navigator" )
      endif
      oDlg5:show()
   CASE cType == "Fonts"
      if oDlg6 ==Nil
         oDlg6 := QFontDialog():new()
         oDlg6:setWindowTitle( "Harbour-QT Font Selector" )
      endif
      oDlg6:show()
   ENDCASE

   RETURN nil


Qbjects are automaticaly destroyed only if they have parent   (
QSomeWidget:New(parent) )
When parent is destroyed, he destroys it's children to.

BRGS
Franček


Pritpal Bedi wrote:
> 
> Hi István
> 
> 
> Bisz István wrote:
>> 
>> The ‘demoqt’ tests with ‘debug_new’ shows a lot of ‘leaked objects’ , see
>> attached ‘debug_new.txt’. As I see now, the objects allocated by the new
>> operator are not released by a corresponding delete operator.
>> 
> 
> I am struggling with this aspect since 20 days and 
> could not reached to any consclusion why Qt is not releasing the 
> objects. To illustrate, just navigate in <Brw> tab in demoxbp and 
> also keep an eye over task manager. You will be surprized to 
> observe that memory keeps on growing all the time.
> Not only here, just move the mouse in/out of the 
> demoxbp window, the same behavior will follow.
> And the worse is, if you play like this for a 
> couple of hours, netxt time, demoxbp.exe will fail to 
> load. You will need to reboot your computer.
> 
> I was wondering why this happens. I rewrote and 
> subclassed QMainWindow() and implemented it for 
> XbpDialog() class to have finer control over events 
> and their execution. However I could not avoid this behavior.
> 
> And today you have confirmed that Qt itself is buggy on this front.
> 
> Even I downloaded Qt 2009.03 and checked all above against it
> but the result is the same.
> 
> Along with above issue, I have one more issue with Qt in 
> respect to its paint engine which fails on MT scenario.
> I will post the modified code and will show what is needed to 
> control it and what heavy penalty we have to pay.
> 
> And thanks for stopping my frustration over the subject.
> 
> Regards
> Pritpal Bedi
> 
> 

-- 
View this message in context: 
http://www.nabble.com/demoqt-tests-with-debug_new---Leaked-objects-tp25434990p25467896.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to