RegisterMessageHandler fails in Visual Studio 2010

26 views
Skip to first unread message

John Freeman

unread,
Feb 23, 2015, 12:25:19 PM2/23/15
to native-cli...@googlegroups.com
I am using vs_addin for Visual Studio 2010, and I have recompiled the win32 libraries for pepper_40 (make TOOLCHAIN=win CONFIG=Debug).

RegisterMessageHandler returns -2, if I build in Linux and run then it will return 0


class MessageHandler : public pp::MessageHandler {
 public:
  virtual void HandleMessage(pp::InstanceHandle instance, const pp::Var& message_data) {}
  virtual pp::Var HandleBlockingMessage(pp::InstanceHandle instance,const pp::Var& message_data) {
     return pp::Var("");
  }
  virtual void WasUnregistered(pp::InstanceHandle instance) {}
};

class NaClProjectInstance : public pp::Instance {
 public:
  explicit NaClProjectInstance(PP_Instance instance): pp::Instance(instance), thread_(this){}

  virtual ~NaClProjectInstance() {
  }

  virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
thread_.Start();
 
int32_t ret = RegisterMessageHandler(&message_handler_, thread_.message_loop());

if (ret  != 0) {
PostMessage("Could not register Message handler");
}

return true;
  }
 private:
  virtual void HandleMessage(const pp::Var& var_message) {
  }

  pp::SimpleThread thread_;
  MessageHandler message_handler_;
};


Sam Clegg

unread,
Feb 23, 2015, 8:46:05 PM2/23/15
to native-cli...@googlegroups.com
Hi John,

It looks like this is most likely an issue with the --ppapi-in-process
flag which is still the default for debugging trusted plugins in
Visual Studio. I managed to reproduce your failure, and removing this
flag fixed it for me. The downside is the debugger then doesn't
attach to the correct process by default. Most likely this new API
lacks testing with the --ppapi-in-process flag. I opened a bug for
this: https://code.google.com/p/chromium/issues/detail?id=461162

cheers,
sam
> --
> You received this message because you are subscribed to the Google Groups
> "Native-Client-Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to native-client-di...@googlegroups.com.
> To post to this group, send email to native-cli...@googlegroups.com.
> Visit this group at http://groups.google.com/group/native-client-discuss.
> For more options, visit https://groups.google.com/d/optout.

John Freeman

unread,
Feb 24, 2015, 4:21:27 AM2/24/15
to native-cli...@googlegroups.com
Thank you Sam, I am now able to debug my message handler
Reply all
Reply to author
Forward
0 new messages