nagyistoce / freemedforms

Automatically exported from code.google.com/p/freemedforms
Other
0 stars 0 forks source link

Identity Form smears when selecting 2nd patient #156

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. open a patient, open the identity form, add an identity if there is none.
2. go to the patients search overview again, open another patient
3. Go to the identity form of the second patient.

What is the expected output? What do you see instead?
I expect to see a normal form (like in screenshot1)
Instead I see a smearing, drawing errors, like in screenshot2.

Seen under Linux (KDE/Unity in Ubuntu 12.04)

Original issue reported on code.google.com by christian.a.reiter@gmail.com on 23 Aug 2012 at 7:50

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was corrected with the 'switch case with missing break' bug 
correction.
Please check and close the issue please.

Original comment by eric.mae...@gmail.com on 24 Aug 2012 at 10:32

GoogleCodeExporter commented 9 years ago
Negative. Bug is still there, and I think I recognized this BEFORE i changed 
the "if" to "switch" statements.
And it is just at the SECOND patient, the first opened is not affected  - which 
is strange and shouldn't have anything to do with the switch/break bug.

Original comment by christian.a.reiter@gmail.com on 24 Aug 2012 at 8:26

GoogleCodeExporter commented 9 years ago
Please retry after a clear git pull. I can not reproduce this bug...

Original comment by eric.mae...@gmail.com on 25 Aug 2012 at 7:22

GoogleCodeExporter commented 9 years ago
clear pull, removed bin/build, clean build after "make clean". No shadow build 
remaining before. Should really be good.
But the bug is still there.
Tha "picture in the background" is the same patient shown, not the first one, 
and the scrollview is scrolled down completely - so if I manually scroll down 
to the bottom the two pictures are congruent.
It seems to me like a paint error.

What I found out else is that if I want to make a screenshot using the builtin 
screenshot tool (right upper corner), FMF crashed (reproducible:
open patient, go back to "patients", open another patient, open his Identity, 
click on screenshot button):
SegFault is in qhash.h, line 884: "if (d->numBuckets) {"

Stack trace:
QHash<QString, SpecsBook>::findNode
QHash<QString, SpecsBook>::contains
Trans::MultiLingualClass<SpecsBook>::getLanguage
Form::FormItemSpec::value
Form::FormItemSpec::label
BaseWidgets::Internal::BaseSimpleText::retranslate
Form::IFormWidget::changeEvent

Original comment by christian.a.reiter@gmail.com on 25 Aug 2012 at 3:13

Attachments:

GoogleCodeExporter commented 9 years ago
Nothing reproducible here.
- clean compilation, 
- git status  -> no modification from my last git pull (one minute ago)
- enable to reproduce your bugs on mac && ubuntu 12.04

What does say your git status ?

Original comment by eric.mae...@gmail.com on 25 Aug 2012 at 5:11

GoogleCodeExporter commented 9 years ago
git status is only a small change ni webcamdialog.ui (just width/height of 
openCVWidget) - nothing to do with that. Running ubuntu 12.04 with kubuntu ppa, 
libqt version 4:4.8.1-0ubuntu4.2.

I'll do a FRESH git clone in a tmp dir and compile it with the build.sh script. 
We'll see then.

Original comment by christian.a.reiter@gmail.com on 25 Aug 2012 at 5:31

GoogleCodeExporter commented 9 years ago
under fresh clone same issue (Ubuntu 12.04)!!

Original comment by christian.a.reiter@gmail.com on 25 Aug 2012 at 9:26

GoogleCodeExporter commented 9 years ago
while retesting under ubuntu 12.04 I found a compilation bug (maindow laking 
the patientbase dependency in the plugin.pro). But the UI is absolutely clean.

I'm starting a fully clean build.

Original comment by eric.mae...@gmail.com on 25 Aug 2012 at 9:43

GoogleCodeExporter commented 9 years ago
Clean build on ubuntu 12.04 gnome qt4:4.8.1. 

For the UI: No problem at all. All works fine... There are just some lines that 
are drawn between the identity widget and the scrollbar.

For segfault: not reproductible.

May be Kubuntu specific bugs????

Project qmake extra-args:
  LOWERED_APPNAME=freemedforms "CONFIG+=debug_without_install with-webcam"

Original comment by eric.mae...@gmail.com on 25 Aug 2012 at 10:10

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I tested again with fresh build under Ubuntu (not Kubuntu now) - yes, same 
result, same screenshot, just the few lines on the right side.
But then there IS a bug, because under KDE which is pure Qt the bug is visible 
and under Gnome which uses a gtk engine that emulates the Qt style the bug is 
just visible a bit - the painting is in the background visible - but it should 
notpaint anything there.
Can you see this under Windows?

Original comment by christian.a.reiter@gmail.com on 25 Aug 2012 at 10:19

Attachments:

GoogleCodeExporter commented 9 years ago
BTW: same binary nder Ubuntu/Kubuntu.

Original comment by christian.a.reiter@gmail.com on 25 Aug 2012 at 10:20

GoogleCodeExporter commented 9 years ago
not tested under win32. But on Mac no problem at all. And the lines does not 
appear each time I change of patient...
Hummmmmm, not easy, the widget seems to be painted many times on the parent 
widget. This bug looks like hell on earth!
We must find it... Updating the prioirity of the bug to critical.

Original comment by eric.mae...@gmail.com on 25 Aug 2012 at 10:28

GoogleCodeExporter commented 9 years ago
Trying to check the code today, but bug is no more reproducible... Christian 
can you retest on a fresh compilation please...

Original comment by eric.mae...@gmail.com on 28 Aug 2012 at 9:14

GoogleCodeExporter commented 9 years ago
I still have an empty Identity Form - Eric did you forget to push the changes 
that you partly made at work? Fresh git pull + clean recompile.

Original comment by christian.a.reiter@gmail.com on 29 Aug 2012 at 6:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I tested FMF now in an act of desparation under KDE with various Qt4 engines: 
CD, Motif, Plastique, Oxygen.
The problem occurs ONLY under oxygen. Additionally it seems to have screen 
problems when starting the program in maximized mode: it only shows a half of 
the screen, like the window size would be just the half of the screen.

I can now safely close this bug: it is NOT a problem of FMF, it seems to be an 
Oxygen engine painting problem, as it doesn't occur under Windows, Gnome and 
other Qt4 engines.

Original comment by christian.a.reiter@gmail.com on 6 Sep 2012 at 11:10

GoogleCodeExporter commented 9 years ago
I just saw that this is NOT invalid, reopening this issue.

When starting Gammaray (the tool from KDSB to inspect Qt software), you can see 
in realtime that when you select the formDataMapper (see screenshot) in 
Gammaray, watch it's children, and go to FMF, and click on various forms (just 
switch between two, e.g. "Drugs prescriptions" + "Textual prescriptions", the 
smearing appears - the old form doesn't get unloaded, but the new activated 
form is painting into the same area.

First I thought it is a Qt/graphics engine/Oxygen bug, but in Gammaray you see 
that with each click on the form you get a new formDataMapper child (an unnamed 
QScrollarea), and they never get unloaded.

So we have a memory leak I suppose, in the process of loading a form into the 
formDataMapper!

As FMF is unusable in Kubuntu e.g., I mark this as critical.

Original comment by christian.a.reiter@gmail.com on 6 Mar 2013 at 7:04

Attachments:

GoogleCodeExporter commented 9 years ago
this is a kubuntu specific bug. May be a bug with the 
QStackedLayout/QStackedWidget. This bug does not appear in mac/win/debian. Even 
Ubuntu looks clean (we have to recheck this)...
I'll make a VB with kubuntu to check this. 

Original comment by eric.mae...@gmail.com on 6 Mar 2013 at 7:09

GoogleCodeExporter commented 9 years ago
In Ubuntu you can see the small drawing errors in the background, see 
screenshot in comment #11.
I think this is because GTK has other drawing methods and priorities, so you 
don't see it in the first case.

BUT, in Gammaray you see the memory model of the Qt program. And there I can 
see that for each form that is clicked on, a new form gets LOADED in memory. 
This is not right.
It's ok to load forms on demand and KEEP them in memory for fast referring and 
displaying. But then if you click 20 times on the same two forms alternating, 
you should have only 2 in memory, and not 20.
So this is not a Kubuntu specific bug, I mean it's not related to Kubuntu 
because maybe in older Qt (Debian) or other drawing methods (GTK, Win, Mac) you 
don't see the bug. But there is a memory hole.

Better than setting up a VM with Kubuntu, download GammaRay from KDAB:
http://www.kdab.com/kdab-products/gammaray/
Compile it, you can use the gt version, it's very stable, and has no 
dependencies, runs right out of the box.
Start it, attach to a running FMF, go to widgets, and search for the 
formDataMapper. Open its children and start clicking on FMF forms. Watch in 
Gammaray the formDataMapper children growing.

Original comment by christian.a.reiter@gmail.com on 6 Mar 2013 at 7:29

GoogleCodeExporter commented 9 years ago
Ah ok, may be this code is buggy

FormDataWidgetMapperPrivate

    void clearStackLayout()
    {
        if (_stack)
            delete _stack;  // <-- included widgets are not deleted ?
        _stack = new QStackedLayout(q);
        q->setLayout(_stack);
    }

Try to get all widgets from the layout and delete them one by one with

    QWidget *   widget ( int index ) const
    virtual int count () const
from the stackedlayout

Tell me the result

Original comment by eric.mae...@gmail.com on 6 Mar 2013 at 8:34

GoogleCodeExporter commented 9 years ago
a dirty patch can be:

    void clearStackLayout()
    {
        if (_stack) {
            if (_formMain) {
                QList<Form::FormMain *> forms;
                forms << _formMain;
                forms << _formMain->flattenFormMainChildren();
                foreach(FormMain *form, forms) {
                    if (form->formWidget()) {
                        form->formWidget()->setParent(0);
                    }
                }
            }

            for(int i=0; i < _stack->count(); ++i) {
                delete _stack->widget(i);
            }
            delete _stack;
        }
        _stack = new QStackedLayout(q);
        q->setLayout(_stack);
    }

Looks to work fine under mac. Please can you test?

Original comment by eric.mae...@gmail.com on 6 Mar 2013 at 9:22

GoogleCodeExporter commented 9 years ago
tested and pushed, please confirm

Original comment by eric.mae...@gmail.com on 6 Mar 2013 at 9:30

GoogleCodeExporter commented 9 years ago
works perfectly.
Thanks.

Original comment by christian.a.reiter@gmail.com on 6 Mar 2013 at 9:35

GoogleCodeExporter commented 9 years ago
you didn't write the last lines:
            delete _stack;
        }
        _stack = new QStackedLayout(q);
        q->setLayout(_stack);

But it works without that.
The patch at 
http://code.google.com/p/freemedforms/source/detail?r=0a80cd464a1455ab88263ebcc5
a36816fa68551b
Seems to have done the issue.

Original comment by christian.a.reiter@gmail.com on 6 Mar 2013 at 10:45

GoogleCodeExporter commented 9 years ago
yes there are no need to delete and recreate the stack each time, now that we 
clear the content widget.
This way it's also faster to regenerate the UI.

Original comment by eric.mae...@gmail.com on 6 Mar 2013 at 11:02