Comment 6 for bug 50837

Revision history for this message
tuxator (steffen-trekki) wrote : Re: "Mark All Upgrades" removes all previous markings

as it seems the bug has not been fixed (I can reproduce it in Ubuntu 10.10) and I am almost sure about what the problem is.

for reference: http://bazaar.launchpad.net/~synaptic-developers/synaptic/trunk/annotate/head%3A/gtk/rgmainwindow.cc

following functions are part of this problem (if I'm right):

void RGMainWindow::cbUpgradeClicked [this is the function that is triggered when someone clicks the "Upgrade" button in synaptic]
bool RGMainWindow::askStateChange [this function is triggered by cbUpgradeClicked]

Let's look at function cbUpgradeClicked. look for this line: me->askStateChange(state, nullVector); (atm it's line 3142)
=====explanation of the quite obvious but noteable for someone like me who don't know c++/synaptic source code ========
The called function asks the user if he really wants to install the packages and lists the packages that should be installed. Now, in our case, instead of showing all packages, it only lists the packages that were aquired by the upgrade function. The cause of this is the state variable, which has (as far as I understand the source code, sorry I've never looked at it before) the packages which should be installed/upgraded/removed whatever. If you click "no" in this change window, you'll get your marked package back, which shows us that it was in the state variable 9 lines above, where it says "me->_lister->saveState(state);"

I'm not almost sure what that line does, I tracked it down to http://bazaar.launchpad.net/~synaptic-developers/synaptic/trunk/annotate/head%3A/common/rpackagelister.cc function "saveState" but I can't find any type named pkgState, so I can't say what it "save" function does. My best guess is, that it creates a shadow-copy of the state variable and resets it.
==============================================================================
The only way I see here is to shadow-copy the state variable before calling saveState, then call saveState and before calling "askStateChange", merge "our" shadow-copy with the state variable, so that _all_ changes are included in this variable.

Why I'm not doing this and uploading a text file with the changes: I don't know how to do this in C++. I don't even think I could do it in C#/Java because I don't know the type definition of "state" or how to handle it