Opened 7 years ago
Closed 7 years ago
#69 closed defect (fixed)
Trying to add the lSwitcher widget to a second XCenter hangs the system
Reported by: | Gregg Young | Owned by: | Gregg Young |
---|---|---|---|
Priority: | major | Milestone: | 2.9.0 |
Component: | widget | Version: | |
Keywords: | Cc: |
Description
At minimum it prevents the second XCenter from closing.
Change History (3)
comment:1 by , 7 years ago
comment:3 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Note:
See TracTickets
for help on using tickets.
Information about this problem from Rich Walse:
A widget's WgtInitModule() is akin to a DLL's InitTerm(). It is called when the first XCenter opens and loads all the widget DLLs it can find. It is _not_ called each time a new copy of XCenter is opened because the DLL is already loaded. You would have to close all open XCenters then reopen one to have it called again within the same session.
As such, having your queryAppInstance() in WgtInitModule() doesn't
accomplish much. All it does is prevent someone from killing their
standalone version of lSwitcher and installing the widget version.
Instead, calling queryAppInstance() should be just about the first
thing you do when your window proc receives WM_CREATE.
Again, I have to emphasize that all non-trivial activities must be
done in response to WM_CREATE. Registering a widget-specific window
class in WgtInitModule() gives XCenter a way to activate your widget should the need arise. However, activation doesn't actually happen until XCenter creates a window of that class and PM sends you a WM_CREATE to let you know you're "live". Only at that point can you really decide whether to fish or cut bait.